首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular2(RC-4):无法读取未定义的属性“pathsWithParams”

Angular2(RC-4):无法读取未定义的属性“pathsWithParams”
EN

Stack Overflow用户
提问于 2016-07-30 11:35:38
回答 1查看 195关注 0票数 0

在angular2 RC-4中使用子路由时会出现此错误。

无法读取未定义的属性“pathsWithParams”

我的路由文件包含

代码语言:javascript
复制
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时,问题实际上是存在的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-30 12:11:19

得到了答案谢谢你

实际上,问题在于我们必须使用属性[routerLinkActiveOptions]="{exact: true}",而在html中使用routerLinkActive="active-link"来检查活动路由。

因此,正确的语法是:

代码语言:javascript
复制
<a routerLinkActive="active" [routerLinkActiveOptions]="{exact:true}" [routerLink]='["./Dummy"]'>Dummy</a>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38673498

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档