From d38fff878c88f8eae0dbf5c83b054615567381bb Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 2 Nov 2015 12:05:39 -0600 Subject: [PATCH] feat(nav): make popTo public --- ionic/components/nav/nav-controller.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ionic/components/nav/nav-controller.ts b/ionic/components/nav/nav-controller.ts index fddecfd059..00a054efd8 100644 --- a/ionic/components/nav/nav-controller.ts +++ b/ionic/components/nav/nav-controller.ts @@ -253,10 +253,10 @@ export class NavController extends Ion { * @param view {ViewController} to pop to * @param opts {object} pop options */ - _popTo(view, opts = {}) { + popTo(viewCtrl, opts = {}) { // Get the target index of the view to pop to - let viewIndex = this._views.indexOf(view); + let viewIndex = this._views.indexOf(viewCtrl); let targetIndex = viewIndex + 1; // Don't pop to the view if it wasn't found, or the target is beyond the view list @@ -279,14 +279,13 @@ export class NavController extends Ion { } } - let leavingView = this._views[this._views.length - 1]; - let enteringView = view; + let leavingView = this.getPrevious(viewCtrl); if (this.router) { - this.router.stateChange('pop', enteringView); + this.router.stateChange('pop', viewCtrl); } - this.transition(enteringView, leavingView, opts, resolve); + this.transition(viewCtrl, leavingView, opts, resolve); return promise; }