Angular version is 7 and I want to add active class to the link clicked. Here the link is old school navigation(routing trough ID).
My HTML code follows as below:
<div class="sidenav-container">
<div class="list">
<mat-list role="list">
<mat-list-item role="listitem"
><a
routerLink="./"
fragment="report"
>1. Report</a
></mat-list-item
>
<mat-list-item role="listitem"
><a
routerLink="./"
fragment="profile"
>2. Profile</a
>
</mat-list-item>
</mat-list>
</div>
</div>
And my css file looks as below:
.active {
color: green;
font-weight: 900;
}