本文介绍了在URL散列之前,角斜线加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试在URL添加散列,如:
When i try to add a hash in the url like :
<a href="#whatever">whatever</a>
或
window.location.hash = 'whatever';
它附加一个/散列世人面前。
it appends a '/' before the hash world
=> www.mysite.com/#whatever
但应
=> www.mysite.com#whatever
我知道这是由角造成的,但我可以找到一种方法,prevent它。结果
有没有一种方法,以prevent这种行为?
I know this is caused by angular, but i can find a way to prevent it.
Is there a way to prevent this behaviour ?
感谢
推荐答案
打开HTML5模式:
.config(function($locationProvider) {
$locationProvider.html5Mode(true);
})
看到更多的细节。
这篇关于在URL散列之前,角斜线加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!