javascript - Apply CSS to active router link [Angular 2] -


this question has answer here:

i apply special css style properties active router links:

<a [routerlink]='link'>{{name}}</a>

here tried far (using default router-link-active class):

.router-link-active {  	color: #000;  	font-weight: bold;  }

it doesn't work , don't understand why.

currently angular 2 has built in attribute can use on link used [routerlink] routerlinkactive need have:

<a [routerlink]='link' routerlinkactive="router-link-active">{{name}}</a> 

and recognize route current active route , apply router-link-active class.

note:

for using routerlink on tags other a tags, (personally using on button) routerlinkactive doesn't work should work on next release of router - https://github.com/angular/angular/issues/9755


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -