woshi17 woshi17 - 4 months ago 49
AngularJS Question

angular 2.0.0-rc3: partial route matching with routerLinkActive

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 routing, I also have few secondary routing, 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 routing's class
active
is still exist.

what should I do ?

Answer

Add

[routerLinkActiveOptions]="{ exact: false }"

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

Comments