Angular 2.0.0-rc3: partial route matching with routerLinkActive

被刻印的时光 ゝ 提交于 2019-12-06 11:00:55

问题


I'm using routerLinkActive in my primary routing.

<a [routerLink]="/user" routerLinkActive="active">Bob</a>

When the URL is /user, the active class will be added to the a tag, but under the primary route, I also have a few secondary routes, so when the URL is /user/aa, the active will be removed.

I hope that when the URL is either /user/aa or /user/bb, the primary route's class active still exists.

What should I do?


回答1:


Add

[routerLinkActiveOptions]="{ exact: false }"

As far as I know this is going to be the default with the next update.



来源:https://stackoverflow.com/questions/38090949/angular-2-0-0-rc3-partial-route-matching-with-routerlinkactive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!