Angularjs auto prefixes forward slash
angularjs, javascript, redirect
Solution
@Tushar I'm not sure if you've figured out a solution but I came across your scenario too and no luck with googling. Eventually I figured out it's a rather simple fix, I've added : -
angular.config(function($locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false,
rewriteLinks: false
});
})
And it just stop appending the forward slash (/) prefix to my hash anchor. Everything remains as what we're familiar with (no replacing of URL with hash or what-not).
Problem
If I hit the url say `www.xyz.com/home#route-1` AngularJS automatically re-directs it to `www.xyz.com/home#/route-1` That is - it prefixes the route with a `/` (forward slash) Why is it happening and how can I stop making it do this? Update What I am really looking for is that angular should not attach the forward slash neither remove the hash sign.