I want to remove a class only one ONE route, (Or add a class on all BUT one route.) How is that possible? I have tried [routerLink] with multiple parameters to no avail:
<div class='body-content' [routerLink]="['/fetch-data', '/counter']" [routerLinkActive]="['col-sm-9']" >
<router-outlet></router-outlet>
</div>
Or, is there such a thing as [routerLinkNOTActive] or something similar like so:
<div class='body-content' [routerLink]="['/home']" [routerLinkNotActive]="['col-sm-9']">
so, then it would add the 'col-sm-9' class on all routes that are not '/home'. Seems very simple, but can't find anything to do it.
I don't know if there is a built in directive to do what you want but you can always add some logic to your component.
In your template,
And in your component,
You can have fun and test against whatever combination of routes you wish.
Here's my final solution which just used the [class] attribute. BTW, What happened to the [ng-class] attribute in Angular2?:
HTML:
TypeScript: