Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular add slash before hash in url

Tags:

angularjs

When i try to add a hash in the url like :

<a href="#whatever">whatever</a>

or

window.location.hash = 'whatever';

it appends a '/' before the hash world

=> www.mysite.com/#whatever

but it should be

=> www.mysite.com#whatever

I know this is caused by angular, but i can find a way to prevent it.
Is there a way to prevent this behaviour ?

Thanks

like image 874
Abel Chalier Avatar asked Feb 07 '15 23:02

Abel Chalier


1 Answers

Turn on html5 mode:

.config(function($locationProvider) {
  $locationProvider.html5Mode(true);
})

See more detail here.

like image 109
Bhojendra Rauniyar Avatar answered Nov 15 '22 23:11

Bhojendra Rauniyar