最近做一個web應用,有個需求需要刪除angular路由中的#號。
例如:
http://example.com/
http://example.com/#/about
http://example.com/#/contact
需要改成
http://example.com/
http://example.com/about
http://example.com/contact
這個是angular默認自帶的,所以想要刪除需要配置一下:
$locationProvider.html5Mode(true);
然後再index.html 的header中,指定一個base:
<base href="/">
這就ok了,需要的通知自己嘗試一下吧!