using routerLinkActive with click event
Asked Answered
K

0

7

How can I use routerLinkActive with click event and without routerLink? I read somewhere that using click and routerLink together is not a good practice. I want to set an active class when I click the link and want to perform some business functions on click event before navigating the user to the clicked page. The code below is not setting the class.

<button
    type="button"
    class="list-group-item list-group-item-action"
    routerLinkActive="active"
    *ngFor="let service of services"
    (click)="changeService(service)">
    {{ service | titlecase }}
</button>
Koto answered 10/9, 2018 at 0:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.