Both methods add a new page to the current Nav component, the only difference is which Nav Controller .
, Nav. , , this.navCtrl.push(ThePage), , , , - . , Nav, Nav .
this.app.getRootNav().push(ThePage), Nav , , , , Nav, Nav .
, , (popover, modal, alert ..)
:
Overlay
, (popover, , ..)? popover . popover NavController , getRootNav().
import { Component } from '@angular/core';
import { App, ViewController } from 'ionic-angular';
@Component({
template: `
<ion-content>
<h1>My PopoverPage</h1>
<button ion-button (click)="pushPage()">Call pushPage</button>
</ion-content>
`
})
class PopoverPage {
constructor(
public viewCtrl: ViewController
public appCtrl: App
) {}
pushPage() {
this.viewCtrl.dismiss();
this.appCtrl.getRootNav().push(SecondPage);
}
}