Angular 5 TypeError: outlet is null / cannot read property 'component' of null while routing

只谈情不闲聊 提交于 2019-12-05 10:27:24

Finally found the solution: it appears to be an bug in angular router

I tested it by changing inside:

node_modules\@angular\router\bundles\router.umd.js node_modules\@angular\router\esm2015\router.js node_modules\@angular\router\esm5\router.js

This line:

this.canDeactivateChecks.push(new CanDeactivate(outlet.component, curr));

Into this:

if (outlet && outlet.component) {
    this.canDeactivateChecks.push(new CanDeactivate(outlet.component, curr));
}

And now its working fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!