0 votes
in Angular by
What do you understand by the RouterLinkActive?

1 Answer

0 votes
by

The RouterLinkActive is a directive used to toggle 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 them when the link is inactive.

For example, you can add them to RouterLinks as follows:

  1. <h1>Angular Router</h1>  
  2. <nav>  
  3.   <a routerLink="/todosList" routerLinkActive="active">List of todos</a>  
  4.   <a routerLink="/completed" routerLinkActive="active">Completed todos</a>  
  5. </nav>  
  6. <router-outlet></router-outlet>  

Related questions

0 votes
asked Jun 5, 2022 in Angular by Robindeniel
0 votes
asked Jan 15, 2020 in Angular by rahuljain1
...