From 8f1a0b40f9eee1172069e002e2be8977ac9e6b60 Mon Sep 17 00:00:00 2001
From: Adam Bradley
Date: Fri, 9 Oct 2015 00:18:02 -0500
Subject: [PATCH] Revert "NavController popTo takes componentType"
This reverts commit 63aebf8ba89120f3347977c69130ec1d86cf0410.
---
ionic/components/nav/nav-controller.ts | 30 +++++++-----------------
ionic/components/nav/test/basic/index.ts | 5 ----
2 files changed, 8 insertions(+), 27 deletions(-)
diff --git a/ionic/components/nav/nav-controller.ts b/ionic/components/nav/nav-controller.ts
index a443ec7194..91edc2d10e 100644
--- a/ionic/components/nav/nav-controller.ts
+++ b/ionic/components/nav/nav-controller.ts
@@ -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
diff --git a/ionic/components/nav/test/basic/index.ts b/ionic/components/nav/test/basic/index.ts
index 91df16917d..d20838f9bf 100644
--- a/ionic/components/nav/test/basic/index.ts
+++ b/ionic/components/nav/test/basic/index.ts
@@ -105,7 +105,6 @@ class SecondPage {
-