AngularJS路由刪除#符號解決的辦法
最近做一個web應用,有個需求需要刪除angular路由中的#號。
例如:
http://example.com/http://example.com/#/abouthttp://example.com/#/contact
需要改成
http://example.com/http://example.com/abouthttp://example.com/contact
這個是angular默認自帶的,所以想要刪除需要配置一下:
$locationProvider.html5Mode(true);
然后再index.html 的header中,指定一個base:
<base href="/" rel="external nofollow" >
這就ok了,需要的通知自己嘗試一下吧!
如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答
圖片精選