2017-04-19 19 views
-1

我正在使用狀態提供程序,並使用locationprovider啓用了html5,並在索引文件中添加了bse標記。但它不起作用。如何從角度UI路由器中刪除#

+0

我已經嘗試過解決方案,但它不是working.I現在用$ stateprovider –

+0

請參閱代碼[鏈接](https://jsfiddle.net/gp80crnL/) –

+0

@VenkateshParuchuri鏈接加工。檢查我的答案,有點不同,但同樣的組件使用 – Zooly

回答

1

配置您的應用$ locationProvider:

function config($routeProvider, $locationProvider) { 
 
    $locationProvider.hashPrefix(''); 
 
    $locationProvider.html5Mode(true); 
 
    
 
    // Routes 
 
}

和HTML:

<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <base href="/"> 
 
</head>

hashPrefix刪除「! 「

來源:https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag

+0

謝謝你@HugoTor –

+0

希望它對你有用:) – Zooly

+0

這是工作。#已經消失形式URl,當我刷新頁面的URL不working.getting頁面未找到錯誤 –