custom navigation for different user using core UI Angular template but I am getting some weird error in console

假如想象 提交于 2020-05-17 10:24:05

问题


AppSidebarNavItemsComponent.html:33 ERROR TypeError: Cannot read property 'length' of undefined at createUrlTree (router.js:1902) at Router.push../node_modules/@angular/router/fesm5/router.js.Router.createUrlTree (router.js:4220) at AppSidebarNavLinkComponent.push../node_modules/@coreui/angular/fesm5/coreui-angular.js.AppSidebarNavLinkComponent.ngOnInit (coreui-angular.js:1317) at checkAndUpdateDirectiveInline (core.js:22494) at checkAndUpdateNodeInline (core.js:31090) at checkAndUpdateNode (core.js:31052) at debugCheckAndUpdateNode (core.js:31686) at debugCheckDirectivesFn (core.js:31646) at Object.eval [as updateDirectives] (AppSidebarNavItemsComponent.html:33) at Object.debugUpdateDirectives [as updateDirectives] (core.js:31638)


回答1:


I've found that the issue for me was how the navigation items were incorrectly defined.

Make sure that items with no URL are properly marked as either divider: true or title: true

The problematic element for me was:

{
    name: 'HELLO'
}

Changed it to:

{
    name: 'HELLO',
    title: true
}

No more console error, I can change items all I want without errors.



来源:https://stackoverflow.com/questions/61138035/custom-navigation-for-different-user-using-core-ui-angular-template-but-i-am-get

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