Good morning guys, I have a doubt, as a beginner, that I created two pages on Ionic v2 but I do not know how I can navigate between them. Looking at the ionic documentation I saw this navController I adapted the code it gave but it did not work.
login.html
<ion-footer>
<ion-toolbar>
<p>Nao e cadastrado? <button ion-button clear (click)="pushPage()">cadastre-se</button>
</p>
login.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, LoadingController,App, ViewController } from 'ionic-angular';
import { RegisterPage } from '../register/register';
/**
* Generated class for the LoginPage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
constructor( public navCtrl: NavController,
public navParams: NavParams,
public loadingCtrl: LoadingController,
public viewCtrl: ViewController,
public appCtrl: App) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
presentLoading() {
this.loadingCtrl.create({
content: 'Por favor aguarde...',
duration: 3000,
dismissOnPageChange: true
}).present();
}
pushPage() {
this.viewCtrl.dismiss();
this.appCtrl.getRootNav().push(RegisterPage);
}
}
ERROR: Runtime Error
Uncaught (in promise): navigation stack needs at least one root page