在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时,问题实际上是存在的。
发布于 2016-07-30 12:11:19
得到了答案谢谢你
实际上,问题在于我们必须使用属性[routerLinkActiveOptions]="{exact: true}",而在html中使用routerLinkActive="active-link"来检查活动路由。
因此,正确的语法是:
<a routerLinkActive="active" [routerLinkActiveOptions]="{exact:true}" [routerLink]='["./Dummy"]'>Dummy</a>https://stackoverflow.com/questions/38673498
复制相似问题