在URL中使用hash之前添加斜杠

Abe*_*ier 8 angularjs

当我尝试在网址中添加哈希时:

<a href="#whatever">whatever</a>
Run Code Online (Sandbox Code Playgroud)

要么

window.location.hash = 'whatever';
Run Code Online (Sandbox Code Playgroud)

它在哈希世界之前附加一个'/'

=> www.mysite.com/#whatever
Run Code Online (Sandbox Code Playgroud)

但它应该是

=> www.mysite.com#whatever
Run Code Online (Sandbox Code Playgroud)

我知道这是由角度引起的,但我可以找到一种方法来防止它.
有没有办法防止这种行为?

谢谢

Bho*_*yar 9

打开html5模式:

.config(function($locationProvider) {
  $locationProvider.html5Mode(true);
})
Run Code Online (Sandbox Code Playgroud)

在这里查看更多细节.