Angular · Junior · Question 57 of 75

How do you highlight the menu link for the current route?

<a routerLink="/users" routerLinkActive="active">Users</a>

Explanation

The directive adds the class while the link's route is active. [routerLinkActiveOptions]="{ exact: true }" prevents / from matching every page.

Further reading

Problem with a question

Angular · Junior · question 57

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz