angular - 使用核心 UI Angular 模板为不同用户自定义导航,但我在控制台中遇到一些奇怪的错误
问题描述
AppSidebarNavItemsComponent.html:33 错误类型错误:无法在 Router.push../node_modules/@angular/router/fesm5/router.js.Router.createUrlTree (router.js:1902) 处读取未定义的属性“长度”。 .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 [as updateDirectives] (AppSidebarNavItemsComponent.html:33) 在Object.debugUpdateDirectives [as updateDirectives] (core.js:31638)
解决方案
我发现我的问题是导航项的定义不正确。
确保没有 URL 的项目被正确标记为divider: true
或者title: true
对我来说有问题的元素是:
{
name: 'HELLO'
}
将其更改为:
{
name: 'HELLO',
title: true
}
不再出现控制台错误,我可以随意更改项目而不会出错。
推荐阅读
- python - awk的python替代品?
- javascript - 我的 sendtowhatsapp.js 不执行我的表单
- arrays - 使用一个数组值访问另一个数组元素 Matlab
- c++ - 强制转换为 bool 是检查是否存在与键匹配的 unordered_map 值的有效方法吗?C++
- python - 给定一个多嵌套的 Python 函数,如何在一些任意嵌套的函数中一直访问闭包变量?
- leaflet - Leaflet - geoJSON multipolygon - bindPopup 与 bindTooltip
- processor - 现代四核笔记本电脑是 i7-7700 英特尔处理器、SISD 类型还是 SIMD 类型或 MIMD 类型?
- javascript - 肝线summernote没有触发文本区域的变化
- linux - 在不同的终端选项卡中运行由一个 bash startscript 启动的不同 bash 脚本
- xslt - 我试图在 XSLT 中按 2 个不同的元素进行分组。首先是 HOSTLOCID,然后是 HOSTVENDORLOCID