import {App, NavController} from 'ionic/ionic'; import {Page, Config, IonicApp} from 'ionic/ionic'; import {NavParams, NavController} from 'ionic/ionic'; @Page({ template: ` FriendsEnemies S1 {{title}} Push (Go to 2nd) Push w/ [nav-push] array (Go to 2nd) Push w/ [nav-push] and [nav-params] (Go to 2nd) Push w/ [nav-push] array and string view name (Go to 2nd) Push w/ nav-push and [nav-params] (Go to 2nd) setViews() (Go to 3rd, no history) ` }) class FirstPage { constructor( nav: NavController, app: IonicApp, config: Config ) { this.nav = nav; this.title = 'First Page'; this.pushPage = SecondPage; } setViews() { let items = [ ThirdPage ]; this.nav.setViews(items); } push() { this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] } ); } } @Page({ template: ` Second page This page does not have a nav bar! Pop (Go back to 1st) Pop with NavPop (Go back to 1st) Push (Go to 3rd) setViews() (Go to 3rd, FirstPage 1st in history) ` }) class SecondPage { constructor( nav: NavController, params: NavParams ) { this.nav = nav; this.params = params; console.log('Second page params:', params); } setViews() { let items = [ FirstPage, ThirdPage ]; this.nav.setViews(items); } pop() { this.nav.pop(); } push() { this.nav.push(ThirdPage); } } @Page({ template: ` Third Page Header Push (Go to 4th) Pop (Go back to 2nd) Insert first page into history before this Remove second page in history ` }) class ThirdPage { constructor( nav: NavController ) { this.nav = nav } push() { this.nav.push(FourthPage); } pop() { this.nav.pop() } insert() { this.nav.insert(FirstPage, 2); } removeSecond() { this.nav.remove(1); } } @Page({ template: ` Fourth Page Header Pop (Go back to 3rd) ` }) class FourthPage { constructor( nav: NavController ) { this.nav = nav } } @App({ template: ` `, views: [FirstPage, SecondPage, ThirdPage] }) class E2EApp { constructor() { this.root = FirstPage; } }
{{title}}
Push (Go to 2nd)
Push w/ [nav-push] array (Go to 2nd)
Push w/ [nav-push] and [nav-params] (Go to 2nd)
Push w/ [nav-push] array and string view name (Go to 2nd)
Push w/ nav-push and [nav-params] (Go to 2nd)
setViews() (Go to 3rd, no history)
This page does not have a nav bar!
Pop (Go back to 1st)
Pop with NavPop (Go back to 1st)
Push (Go to 3rd)
setViews() (Go to 3rd, FirstPage 1st in history)
Push (Go to 4th)
Pop (Go back to 2nd)
Insert first page into history before this
Remove second page in history
Pop (Go back to 3rd)