fix(nav): it is not allowed to pop all the views

This commit is contained in:
Manu Mtz.-Almeida
2016-11-04 20:18:29 +01:00
parent 5f1a86265c
commit 0ab990c015

View File

@ -248,14 +248,15 @@ export class NavControllerBase extends Ion implements NavController {
if (!ti) { if (!ti) {
return false; return false;
} }
// set that this nav is actively transitioning
this.setTransitioning(true);
// Get entering and leaving views // Get entering and leaving views
const leavingView = this.getActive(); const leavingView = this.getActive();
const enteringView = this._getEnteringView(ti, leavingView); const enteringView = this._getEnteringView(ti, leavingView);
assert(leavingView || enteringView, 'Both leavingView and enteringView are null'); assert(leavingView || enteringView, 'both leavingView and enteringView are null');
// set that this nav is actively transitioning
this.setTransitioning(true);
// Initialize enteringView // Initialize enteringView
if (enteringView && isBlank(enteringView._state)) { if (enteringView && isBlank(enteringView._state)) {
@ -328,6 +329,16 @@ export class NavControllerBase extends Ion implements NavController {
} }
_postViewInit(enteringView: ViewController, leavingView: ViewController, ti: TransitionInstruction, resolve: TransitionResolveFn) { _postViewInit(enteringView: ViewController, leavingView: ViewController, ti: TransitionInstruction, resolve: TransitionResolveFn) {
assert(leavingView || enteringView, 'Both leavingView and enteringView are null');
if (!enteringView && !this._isPortal) {
console.warn(`You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.`,
this, this.getNativeElement());
ti.reject && ti.reject('navigation stack needs at least one root page');
return false;
}
const opts = ti.opts || {}; const opts = ti.opts || {};
const insertViews = ti.insertViews; const insertViews = ti.insertViews;
const removeStart = ti.removeStart; const removeStart = ti.removeStart;