How to add class to Router link when active in Angular

Use the following to add an active class to a menu item or active link when you are visiting the exact page:

<ion-item routerLinkActive="active-link" lines="none" routerDirection="forward" routerLink="/" [routerLinkActiveOptions]="{exact:
    true}">My link</ion-item>

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!