This directive lets you add a CSS class to an element when the link's route becomes active. Consider the following example: <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a> When the url is either '/user' or '/user/bob', the active-link class will be added to the a tag. If the url changes, the class will be removed.

Jan 18, 2019 · Learn many ways by which we can add styles to Angular component using inline, external, template inline styles, ngClass,ngStyle, className, class etc Nov 18, 2017 · The RouterLinkActive directive in the Angular Router module allows us to add "active" CSS classes to a navigation item (or item container) when the current route subsumes the given RouterLink command.