diff --git a/src/components/nav/test/basic/index.ts b/src/components/nav/test/basic/index.ts index 3321854fd7..301a7da0b0 100644 --- a/src/components/nav/test/basic/index.ts +++ b/src/components/nav/test/basic/index.ts @@ -46,7 +46,7 @@ class MyCmpTest {} - + @@ -66,8 +66,8 @@ class FirstPage { @ViewChild(Content) content: Content; constructor( - private nav: NavController, - private view: ViewController + public navCtrl: NavController, + public view: ViewController ) { for (var i = 1; i <= 50; i++) { this.pages.push(i); @@ -79,36 +79,36 @@ class FirstPage { { page: PrimaryHeaderPage } ]; - this.nav.setPages(items); + this.navCtrl.setPages(items); } setRoot() { - this.nav.setRoot(PrimaryHeaderPage); + this.navCtrl.setRoot(PrimaryHeaderPage); } pushPrimaryHeaderPage() { - this.nav.push(PrimaryHeaderPage); + this.navCtrl.push(PrimaryHeaderPage); } pushFullPage() { - this.nav.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }); + this.navCtrl.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }); } pushAnother() { - this.nav.push(AnotherPage); + this.navCtrl.push(AnotherPage); } quickPush() { - this.nav.push(AnotherPage); + this.navCtrl.push(AnotherPage); setTimeout(() => { - this.nav.push(PrimaryHeaderPage); + this.navCtrl.push(PrimaryHeaderPage); }, 150); } quickPop() { - this.nav.push(AnotherPage); + this.navCtrl.push(AnotherPage); setTimeout(() => { - this.nav.remove(1, 1); + this.navCtrl.remove(1, 1); }, 250); } @@ -135,7 +135,7 @@ class FirstPage {

Full page

This page does not have a nav bar!

-

+

@@ -147,10 +147,10 @@ class FirstPage { }) class FullPage { constructor( - private nav: NavController, - private app: App, - private alertCtrl: AlertController, - private params: NavParams + public navCtrl: NavController, + public app: App, + public alertCtrl: AlertController, + public params: NavParams ) {} setPages() { @@ -159,19 +159,19 @@ class FullPage { { page: PrimaryHeaderPage } ]; - this.nav.setPages(items); + this.navCtrl.setPages(items); } pushPrimaryHeaderPage() { - this.nav.push(PrimaryHeaderPage); + this.navCtrl.push(PrimaryHeaderPage); } pushAnother() { - this.nav.push(AnotherPage); + this.navCtrl.push(AnotherPage); } pushFirstPage() { - this.nav.push(FirstPage); + this.navCtrl.push(FirstPage); } presentAlert() { @@ -182,11 +182,12 @@ class FullPage { text: 'Dismiss', role: 'cancel', handler: () => { - // overlays are added and removed from the root navigation - // ensure you using the root navigation, and pop this alert - // when the alert is done animating out, then pop off the active page - this.app.getRootNav().pop().then(() => { - this.app.getRootNav().pop(); + // overlays are added and removed from the app root's portal + // in the example below, alert.dismiss() dismisses the alert + // from the app root portal, and once it's done transitioning out, + // this the active page is popped from the nav + alert.dismiss().then(() => { + this.navCtrl.pop(); }); // by default an alert will dismiss itself @@ -217,11 +218,11 @@ class FullPage { -

+

-

+

@@ -243,9 +244,9 @@ class FullPage { }) class PrimaryHeaderPage { constructor( - private nav: NavController, - private alertCtrl: AlertController, - private viewCtrl: ViewController + public navCtrl: NavController, + public alertCtrl: AlertController, + public viewCtrl: ViewController ) {} ionViewWillEnter() { @@ -253,23 +254,23 @@ class PrimaryHeaderPage { } pushAnother() { - this.nav.push(AnotherPage); + this.navCtrl.push(AnotherPage); } pushFullPage() { - this.nav.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }); + this.navCtrl.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }); } insert() { - this.nav.insert(2, FirstPage); + this.navCtrl.insert(2, FirstPage); } removeSecond() { - this.nav.remove(1); + this.navCtrl.remove(1); } setRoot() { - this.nav.setRoot(AnotherPage); + this.navCtrl.setRoot(AnotherPage); } presentAlert() { @@ -303,7 +304,7 @@ class PrimaryHeaderPage { Back button hidden w/ ion-navbar hideBackButton - + @@ -335,26 +336,26 @@ class AnotherPage { bbCount = 0; constructor( - private nav: NavController, - private viewCtrl: ViewController + public navCtrl: NavController, + public viewCtrl: ViewController ) { console.log('Page, AnotherPage, constructor', this.viewCtrl.id); } pushFullPage() { - this.nav.push(FullPage); + this.navCtrl.push(FullPage); } pushPrimaryHeaderPage() { - this.nav.push(PrimaryHeaderPage); + this.navCtrl.push(PrimaryHeaderPage); } pushFirstPage() { - this.nav.push(FirstPage); + this.navCtrl.push(FirstPage); } setRoot() { - this.nav.setRoot(FirstPage); + this.navCtrl.setRoot(FirstPage); } toggleBackButton() {