Skip to main content
InterviewHubPRO
Section Overview
Q68

Question 68 of 283

Part 3: Angular Router, Navigation & SSR Universal (63 - 75)

24%
Angular Master (283 Qs)•Part 3: Angular Router, Navigation & SSR Universal (63 - 75)

What are active router links?

junior LevelCode ExampleRoutingSSR & Hydration

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.

html
<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>