angular $location服务的配置

来源:互联网 发布:网络商标查询 编辑:程序博客网 时间:2024/06/06 16:28

版权声明:此文首发于我的个人站angular $location服务的配置,转载请注明出处。

locationURL使location服务,需要获得$locationProvider,并配置:
html5Mode(true); //开启html5模式
如下:

.config(['$locationProvider', function($locationProvider) {      $locationProvider.html5Mode(true); }])

有时,在locationProvider.html5Mode(true)location:nobase,需要在头部添加<base href="/" />