How to remove immediate slash(/) after hash(#) in angular

Viewed 239

I configured my angular 8 app routing with {useHash:true}.

When i opened a url in browser say for example

https://localhost:4200/#/todo
https://localhost:4200/#/todo/12

I do not want that additional / immediately after #. what configuration has to be added in angular to achieve above.

https://localhost:4200/#todo
https://localhost:4200/#todo/12

I have this requirement so that my urls are compatible with routes of my non angular microservices which are been loaded inside angular apps

1 Answers

{useHash:true} exists firstly for old browsers, that do not support History API. Without # it wasn't possible to change url without reloading the whole page. I would recommend you not to use hash in your app. The behavior you are trying to change is not configurable.

Related