I'm using angular and hashlocationstrategy:
my default link to site is https://mywebsite.com/#/
if i want to share on LinkedIn a sub route from my website like https://mywebsite.com/#/123 the link show as https://mywebsite.com/ #/123
I tried to remove # but angular use this strategies to load the correct page any idea to replace # or remove it and keep redirecting to the same point in angular ?
As Aakash commented, your choices are to:
This is because browsers/servers ignore anything after #'s. That means that linking to http://example.com/#/something
will load example.com's index.html page (or whatever the server is set up to serve as default). Once index is served, Angular loads, reads the route NOT ignoring everything after the # and proceeds to handle the routing.
Without #'s, going to the same http://example.com/something
will attempt to load something.html, which for an angular app doesn't exist so the server will 404. The server needs to be set up to serve the base index.html in such events. Once said index is served, Angular loads, reads the route and proceeds to handle the routing.
Thank you, looks like i need to update my server code
anyway i fixed my problem by adding "/" before # to be something like example.com/#/something not example.com#/something
Ah, yes, I didn't see that missing slash in your question. Without changing the strategy, that would indeed be the fix. ;)
Thank you, also your answer is good to think about it :)