diff --git a/src/components/modal/test/basic/index.ts b/src/components/modal/test/basic/index.ts index 3723d740b21..ee4c7c8d6d3 100644 --- a/src/components/modal/test/basic/index.ts +++ b/src/components/modal/test/basic/index.ts @@ -137,6 +137,7 @@ class E2EPage { ` }) class NavigableModal { + constructor(public navCtrl: NavController) {} submit() { @@ -158,11 +159,11 @@ class NavigableModal { ` }) class NavigableModal2 { - constructor(public navController: NavController) { - } + + constructor(public navCtrl: NavController) {} submit() { - this.navController.pop(); + this.navCtrl.pop(); } } diff --git a/src/components/nav/nav-controller-base.ts b/src/components/nav/nav-controller-base.ts index 5f68c8dafcf..8643da05ae2 100644 --- a/src/components/nav/nav-controller-base.ts +++ b/src/components/nav/nav-controller-base.ts @@ -193,6 +193,13 @@ export class NavControllerBase extends Ion implements NavController { // get the leaving view which the _insert() already set let leavingView = this.getByState(STATE_INIT_LEAVE); + if (!leavingView && this._isPortal) { + // if we didn't find an active view, and this is a portal + let activeNav = this._app.getActiveNav(); + if (activeNav) { + leavingView = activeNav.getByState(STATE_INIT_LEAVE); + } + } // start the transition, fire resolve when done... this._transition(enteringView, leavingView, opts, done); @@ -224,6 +231,14 @@ export class NavControllerBase extends Ion implements NavController { // first see if there's an active view let view = this.getActive(); + if (!view && this._isPortal) { + // if we didn't find an active view, and this is a portal + let activeNav = this._app.getActiveNav(); + if (activeNav) { + view = activeNav.getActive(); + } + } + if (view) { // there's an active view, set that it's initialized to leave view.state = STATE_INIT_LEAVE; @@ -343,6 +358,16 @@ export class NavControllerBase extends Ion implements NavController { // get the view thats ready to enter let enteringView = this.getByState(STATE_INIT_ENTER); + if (!enteringView && this._isPortal) { + // if we didn't find an active view, and this is a portal + let activeNav = this._app.getActiveNav(); + if (activeNav) { + enteringView = activeNav.last(); + if (enteringView) { + enteringView.state = STATE_INIT_ENTER; + } + } + } if (!enteringView && !this._isPortal) { // oh nos! no entering view to go to! // if there is no previous view that would enter in this nav stack diff --git a/src/components/nav/nav-portal.ts b/src/components/nav/nav-portal.ts index 38ee8a4b6bd..49314018e84 100644 --- a/src/components/nav/nav-portal.ts +++ b/src/components/nav/nav-portal.ts @@ -26,6 +26,7 @@ export class NavPortal extends NavControllerBase { ) { super(null, app, config, keyboard, elementRef, zone, renderer, compiler, gestureCtrl); this._isPortal = true; + this._init = true; this.setViewport(viewPort); app.setPortal(this);