It does not leave the CadastroPage page for the LoginPage page, but it goes from LoginPage to registerPage correctly. I used this code:
login.ts (This is my rootPage)
import { Component } from ‘@angular/core’;
import { NavController, NavParams } from ‘ionic-angular’;
/* Páginas */
import { CadastroPage } from '../cadastro/cadastro';
/*
Generated class for the Login page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-login',
templateUrl: 'login.html'
})
export class LoginPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
/* Transição de Páginas */
nextCadastroPage() {
this.navCtrl.push(CadastroPage);
}
}
cadastro.ts
import { Component } from ‘@angular/core’;
import { NavController, NavParams } from ‘ionic-angular’;
/* Páginas */
import { LoginPage } from '../login/login';
/*
Generated class for the Cadastro page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-cadastro',
templateUrl: 'cadastro.html'
})
export class CadastroPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
/* Transição de Página */
this.navCtrl.setRoot(CadastroPage);
}
ionViewDidLoad() {
console.log('ionViewDidLoad CadastroPage');
}
/* Transição de Página */
nextLoginPage() {
this.navCtrl.pop(LoginPage);
}
}