1

iam strugling to make a direct anchor link to a site. when ever i try to link to the id via: https://www.somesite.com/cl/details/agents#20841
where #20841 is my anchor tag. Angular breaks the url and makes it:
https://www.somesite.com/cl/details/agents#!#20841
this works fine in chrome and firefox, but in internet explorer and edge it dosnt, so it "breaks" the url. Ive tried to change the prefix to "!", instead of "/".

Anyone have a work around for this problem?

1 Answers1

1

If you are using Angular 1.6, you can remove this prefix by adding this code to your config:

appModule.config(['$locationProvider', function($locationProvider) {
  $locationProvider.hashPrefix('');
  $locationProvider.html5Mode(true);
}]);

Note that it could not be supported in IE9 dues to HTML5 compatibilty.

See this link for more information.

Community
  • 1
  • 1
Mistalis
  • 17,793
  • 13
  • 73
  • 97