Is there any way to use Angular build in router properties, such as RouterLinkActive
to detect click on the link to current page?
In the footer I want to add function to scroll to top if clicked on the current page link.
I have this:
<a *ngIf="!sublinkItem.outerLink" [title]="sublinkItem.altText"
[routerLink]="[sublinkItem.link]" routerLinkActive="active"
[routerLinkActiveOptions]="{exact: true}"
class="dropdown-item outer-link"
[innerHTML]="sublinkItem.text">
</a>
And I have function in the component:
scrollToTop(): void {...}
I want to fire this function only, if routerLinkActive is true.