0

How can I remove these encoding in angular? Or replace them when routing...

enter image description here

This is simple html link

/pages/usersadmin

but when it renders it encoded "/" into "/%2F%2F"

TAHA SULTAN TEMURI
  • 4,031
  • 2
  • 40
  • 66
  • are you looking for safe url , here is the answer : https://stackoverflow.com/questions/53222357/angular-6-sanitize-local-drive-url/53224277#53224277 – Joel Joseph Nov 12 '19 at 07:14
  • Can you show the html file and the related component class. Usually anchor tags will not be encoded. – banu saladi Nov 12 '19 at 07:31

1 Answers1

0

The string that you show on screen is indeed encoded with encodeURIComponent so if you use the opposite decodeURIComponent on that string you will get the url.

link: any = decodeURIComponent('http%3A%2F%2Flocalhost%3F%3Dtest');
// will be decoded as http://localhost?=test