Revert "NavController popTo takes componentType"

This reverts commit 63aebf8ba8.
This commit is contained in:
Adam Bradley
2015-10-09 00:18:02 -05:00
parent b0bc991456
commit 8f1a0b40f9
2 changed files with 8 additions and 27 deletions

View File

@@ -253,15 +253,16 @@ export class NavController extends Ion {
}
/**
* Pop to a specific page in the history stack
* @private
* Pop to a specific view in the history stack
*
* @param componentType the page to pop to
* @param view {ViewController} to pop to
* @param opts {object} pop options
*/
popTo(componentType, opts = {}) {
_popTo(view, opts = {}) {
// Get the target index of the view to pop to
let viewIndex = this.getIndexByComponentType(componentType);
let viewIndex = this._views.indexOf(view);
let targetIndex = viewIndex + 1;
let resolve;
let promise = new Promise(res => { resolve = res; });
@@ -271,6 +272,7 @@ export class NavController extends Ion {
return;
}
opts.direction = opts.direction || 'back';
// get the views to auto remove without having to do a transiton for each
@@ -285,7 +287,7 @@ export class NavController extends Ion {
}
let leavingView = this._views[this._views.length - 1];
let enteringView = this.getByIndex(viewIndex);
let enteringView = view;
if(this.router) {
this.router.stateChange('pop', enteringView);
@@ -303,7 +305,7 @@ export class NavController extends Ion {
* @param opts extra animation options
*/
popToRoot(opts = {}) {
this.popTo(this._views[0].componentType);
this.popTo(this._views[0]);
}
/**
@@ -814,22 +816,6 @@ export class NavController extends Ion {
return null;
}
/**
* Get the index of the view with the specified componentType
* @param componentType
* @return index
*/
getIndexByComponentType(componentType) {
if (componentType) {
for (let i = 0, ii = this._views.length; i < ii; i++) {
if (this._views[i].componentType === componentType) {
return i;
}
}
}
return null;
}
/**
* TODO
* @param {TODO} index TODO

View File

@@ -105,7 +105,6 @@ class SecondPage {
<button id="from3To2" (click)="pop()">Pop (Go back to 2nd)</button>
<button id="insert" (click)="insert()">Insert first page into history before this</button>
<button id="remove" (click)="removeSecond()">Remove second page in history</button>
<button id="popto" (click)="popTo()">popTo FirstPage</button>
</p>
<div class="yellow"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
</ion-content>
@@ -130,10 +129,6 @@ class ThirdPage {
this.nav.remove(1);
}
popTo() {
this.nav.popTo(FirstPage);
}
}