Angular add slash before hash in url
When I try to add a hash to the url, for example:
<a href="#whatever">whatever</a> or
window.location.hash = 'whatever'; he adds '/' in front of 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 behavior?
thanks
Turn on html5 mode:
.config(function($locationProvider) { $locationProvider.html5Mode(true); }) More details here .
For new users in the AngularJS world, the configuration must be defined when the module is declared. For example:.
var someModule = angular.module("someModule", [/* dependent modules come here */], function ($locationProvider) { $locationProvider.html5Mode({ enabled: true }); });