woshi17
woshi17

Reputation: 43

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 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?

Upvotes: 2

Views: 2447

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 658037

Add

[routerLinkActiveOptions]="{ exact: false }"

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

Upvotes: 5

Related Questions