0 votes
in Angular by

What are active router links?

1 Answer

0 votes
by

RouterLinkActive is a directive that toggles css classes for active RouterLink bindings based on the current RouterState. i.e, The Router will add CSS classes when this link is active and remove when the link is inactive. For example, you can add them to RouterLinks as below.

<h1>Angular Router</h1>

<nav>

  <a routerLink="/todosList" routerLinkActive="active">List of todos</a>

  <a routerLink="/completed" routerLinkActive="active">Completed todos</a>

</nav>

<router-outlet></router-outlet>

...