2

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
  • 6,448
  • 24
  • 80
  • 163

1 Answers1

4

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
  • 413
  • 2
  • 12