【发布时间】:2016-12-05 00:54:08
【问题描述】:
在 angular2 RC-4 中使用子路由时出现此错误
无法读取未定义的属性“pathsWithParams”
我的路由文件包含
export const routes: RouterConfig = [
{ path: '', component: HomeComponent },
{ path: 'demo', component: DummyComponent },
{ path: 'user-profile', component: UserProfileComponent,
children:[
{ path: '', component: ProfileOverview },
{ path: 'smart-points', component: ProfileSmartPoints }
]},
]
有什么想法吗?
更新
问题实际上是每当我在 html 端使用routerLinkActive 时
【问题讨论】:
-
您是否有任何代码引用该
pathsWithParams属性? -
nop 我的路由中没有参数
-
如果你用 plunker 重现它,我相信你可以在这样做的同时自己解决它。
-
是的,找出问题所在:问题是每当我使用
routerLinkActive