C
C
cha-cha2017-02-01 16:28:30
Angular
cha-cha, 2017-02-01 16:28:30

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

1 answer(s)
C
cha-cha, 2017-02-01
@cha-cha

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 your question

Ask a Question

731 491 924 answers to any question