import { Component } from '@angular/core'; import { AlertController, IonicPage, NavController, ViewController } from '../../../../../..'; @IonicPage({ name: 'primary-header-page' }) @Component({ template: ` Primary Color Page Header S1g {{subheader}} Pop Push to AnotherPage Push to FullPage setRoot(AnotherPage) Pop to root Insert first page into history before this Remove second page in history fixed button (alert) I'm a sub footer! Footer ` }) export class PrimaryHeaderPage { subheader: string; constructor( public navCtrl: NavController, public alertCtrl: AlertController, public viewCtrl: ViewController ) {} ionViewDidLoad() { console.log('ionViewDidLoad, PrimaryHeaderPage', this.viewCtrl.id); } ionViewWillEnter() { console.log('ionViewWillEnter, PrimaryHeaderPage', this.viewCtrl.id); this.viewCtrl.setBackButtonText('Previous'); this.subheader = 'I\'m a sub header!'; } ionViewDidEnter() { console.log('ionViewDidEnter, PrimaryHeaderPage', this.viewCtrl.id); } ionViewWillLeave() { console.log('ionViewWillLeave, PrimaryHeaderPage', this.viewCtrl.id); } ionViewDidLeave() { console.log('ionViewDidLeave, PrimaryHeaderPage', this.viewCtrl.id); } ionViewWillUnload() { console.log('ionViewWillUnload, PrimaryHeaderPage', this.viewCtrl.id); } pushAnother() { this.navCtrl.push('another-page'); } pushFullPage() { this.navCtrl.push('full-page', { id: 8675309, myData: [1, 2, 3, 4] }); } insert() { this.navCtrl.insert(2, 'first-page'); } removeSecond() { this.navCtrl.remove(1); } setRoot() { this.navCtrl.setRoot('another-page'); } presentAlert() { let alert = this.alertCtrl.create(); alert.setTitle('Hello Alert'); alert.addButton({ text: 'Dismiss', role: 'cancel', }); alert.present(); } }
Pop
Push to AnotherPage
Push to FullPage
setRoot(AnotherPage)
Pop to root
Insert first page into history before this
Remove second page in history