mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(navcontroller): filter null viewcontrollers
This commit is contained in:
@ -341,12 +341,13 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
return convertToViews(this._linker, insertViews).then((viewControllers) => {
|
return convertToViews(this._linker, insertViews).then((viewControllers) => {
|
||||||
assert(insertViews.length === viewControllers.length, 'lengths does not match');
|
assert(insertViews.length === viewControllers.length, 'lengths does not match');
|
||||||
|
|
||||||
|
viewControllers = viewControllers.filter(v => v !== null);
|
||||||
|
if (viewControllers.length === 0) {
|
||||||
|
throw 'invalid views to insert';
|
||||||
|
}
|
||||||
// Check all the inserted view are correct
|
// Check all the inserted view are correct
|
||||||
for (var i = 0; i < viewControllers.length; i++) {
|
for (var i = 0; i < viewControllers.length; i++) {
|
||||||
var view = viewControllers[i];
|
var view = viewControllers[i];
|
||||||
if (!view) {
|
|
||||||
throw 'invalid views to insert';
|
|
||||||
}
|
|
||||||
var nav = view._nav;
|
var nav = view._nav;
|
||||||
if (nav && nav !== this) {
|
if (nav && nav !== this) {
|
||||||
throw 'inserted view was already inserted';
|
throw 'inserted view was already inserted';
|
||||||
|
Reference in New Issue
Block a user