fix(ViewController): nav must be set as soon as possible

fixes regression in 5a4c6093a72059577544dafe372e06018ee1ed19
fixes #10654
This commit is contained in:
Manu Mtz.-Almeida
2017-03-05 16:00:47 +01:00
parent 1dd88830f9
commit 61a5317b25
5 changed files with 22 additions and 1 deletions

View File

@ -775,7 +775,7 @@ export class NavControllerBase extends Ion implements NavController {
assert(view._nav === this, 'view is not part of the nav');
this._views.splice(index, 0, this._views.splice(existingIndex, 1)[0]);
} else {
assert(!view._nav, 'nav is used');
assert(!view._nav || (this._isPortal && view._nav === this), 'nav is used');
// this is a new view to add to the stack
// create the new entering view
view._setNav(this);

View File

@ -165,6 +165,7 @@ export class ViewController {
*/
dismiss(data?: any, role?: any, navOptions: NavOptions = {}): Promise<any> {
if (!this._nav) {
assert(this._state === ViewState.DESTROYED, 'ViewController does not have a valid _nav');
return Promise.resolve(false);
}
if (this.isOverlay && !navOptions.minClickBlockDuration) {