user1015388
user1015388

Reputation: 1515

angular 4 how to use skipLocationChange with a href

I have a, tag, with href. I don't want to change the URL when this link is clicked but still traverse to where it should be. I saw that we can use skipLocationChange, but not working. Any alternatives suggested.

In my html:

<a href="#/temp" skipLocationChange>linkitem</a>

Upvotes: 2

Views: 2115

Answers (1)

Vlad274
Vlad274

Reputation: 6844

You need to use the [routerLink] directive to access that property

Documentation

<a [routerLink]="['/temp']" skipLocationChange>linkitem</a>

Upvotes: 3

Related Questions