Categories
Angular2 how to add class when route is NOT active?
There is such a wonderful routerLinkActive directive. The opposite is needed. Is there a way (no hassle) to add a class to an element when the route is NOT active?
Answer the question
In order to leave comments, you need to log in
stackoverflow.com/questions/41982000
<a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive" [ngClass]="rla.isActive ? 'classIfActive' : 'classIfNotActive'> </a>
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question