Angular 2.0.0-rc3:部分路由与 routerLinkActive 匹配 [英] Angular 2.0.0-rc3: partial route matching with routerLinkActive
本文介绍了Angular 2.0.0-rc3:部分路由与 routerLinkActive 匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在主要路由中使用了 routerLinkActive
.
I'm using routerLinkActive
in my primary routing.
<a [routerLink]="/user" routerLinkActive="active">Bob</a>
当 URL 为 /user
时,active
类会被添加到 a
标签中,但是在主路由下,我也有一些次要路线,所以当 URL 为 /user/aa
时,活动将被删除.
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.
我希望当 URL 是 /user/aa
或 /user/bb
时,主路由的类 active
仍然存在.
I hope that when the URL is either /user/aa
or /user/bb
, the primary route's class active
still exists.
我该怎么办?
推荐答案
添加
[routerLinkActiveOptions]="{ exact: false }"
据我所知,这将是下次更新时的默认设置.
As far as I know this is going to be the default with the next update.
这篇关于Angular 2.0.0-rc3:部分路由与 routerLinkActive 匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文