diff --git a/src/components/nav/test/insert-views/app-module.ts b/src/components/nav/test/insert-views/app-module.ts index 695f439499..6cdb8ba050 100644 --- a/src/components/nav/test/insert-views/app-module.ts +++ b/src/components/nav/test/insert-views/app-module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, NavController } from '../../../..'; +import { IonicApp, IonicModule, NavController, NavParams } from '../../../..'; @Component({ @@ -34,14 +34,45 @@ export class FirstPage {

Second page

+ + +
` }) export class SecondPage { + _index: number = 0; + constructor(public navCtrl: NavController) {} insertPage() { - this.navCtrl.insert(1, InsertPage); + this.navCtrl.insert(1, InsertPage, { + index: this._index++ + }).then(() => { + console.log('INSERTED! Stack:\n', this.navCtrl.getViews()); + }) + } + + removePage() { + this.navCtrl.remove(1, 1).then(() => { + console.log('REMOVED! Stack:\n', this.navCtrl.getViews()) + }) + } + + removeTwoPages() { + this.navCtrl.remove(this.navCtrl.length() - 2, 2).then(() => { + console.log('REMOVED TWO! Stack:\n', this.navCtrl.getViews()) + }) + } + + testThing() { + console.log('TEST THING'); + this.navCtrl.push(InsertPage).then(() => { + console.log('Pushed', this.navCtrl.getViews()); + console.log('Removing', this.navCtrl.getActive().index-1); + this.navCtrl.remove(this.navCtrl.getActive().index - 1, 1); + console.log('REMOVED! Stack:\n', this.navCtrl.getViews()); + }); } } @@ -50,7 +81,7 @@ export class SecondPage { template: ` - Inserted Paged + Inserted Paged {{index}} @@ -58,7 +89,12 @@ export class SecondPage { ` }) -export class InsertPage {} +export class InsertPage { + index: any; + constructor(params: NavParams) { + this.index = params.get('index'); + } +} @Component({