使用核心UI Angular模板为不同用户自定义导航,但控制台中出现一些奇怪的错误 [英] custom navigation for different user using core UI Angular template but I am getting some weird error in console

查看:66
本文介绍了使用核心UI Angular模板为不同用户自定义导航,但控制台中出现一些奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AppSidebarNavItemsComponent.html:33错误TypeError:无法读取未定义的属性"length"在createUrlTree(router.js:1902)在Router.push ../node_modules/@angular/router/fesm5/router.js.Router.createUrlTree(router.js:4220)在AppSidebarNavLinkComponent.push ../node_modules/@coreui/angular/fesm5/coreui-angular.js.AppSidebarNavLinkComponent.ngOnInit(coreui-angular.js:1317)在checkAndUpdateDirectiveInline(core.js:22494)在checkAndUpdateNodeInline(core.js:31090)在checkAndUpdateNode(core.js:31052)在debugCheckAndUpdateNode(core.js:31686)在debugCheckDirectivesFn(core.js:31646)在Object.eval [作为updateDirectives](AppSidebarNavItemsComponent.html:33)在Object.debugUpdateDirectives [作为updateDirectives](core.js:31638)

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)

推荐答案

我发现对我来说,问题在于导航项的定义不正确.

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

确保没有URL的项目已正确标记为 divider:true title:true

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'
}

将其更改为:

{
    name: 'HELLO',
    title: true
}

不再出现控制台错误,我可以更改所有我想要的项目而不会出现错误.

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

这篇关于使用核心UI Angular模板为不同用户自定义导航,但控制台中出现一些奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆