Search code examples
angularangular-router

How to include anchor at the end of the link using routerlink?


How to include anchor at the end of the link using routerlink?

I need to include an anchor at the end of the link to be able to identify a particular location on the page that will be accessed.

<a [routerLink]="['/page', item.slug]#local"> Button </a>

Page

<a name="local"></a>

Solution

  • <a [routerLink]="['/page', item.slug]#local"> Button </a>

    wont work fine.

    You can refer this one