0

I am trying to send href="#", using routerLink, but it is rendering %23 instead of #.

Not sure what is wrong.

<a routerLink={{item.url}}>item.linkname</a>

item = {
  url: '#',
  linkname:'abcd'
}
raju
  • 5,758
  • 17
  • 61
  • 136

1 Answers1

2

Angular will always encode your URL with encodeURIComponent(). I do not understand what your intention is from a developer prespective but you can either:

  • If you only want to "add" an hashtag to your route you can simply use href instead of router link: <a [href]="item.url">{{ item.linkname }}</a>.
F.Almeida
  • 375
  • 1
  • 10