2013-03-19 25 views
1

我希望能夠捕捉到以「/ @」開頭並以完整瀏覽器重新加載處理的網站中的任何鏈接。angularjs:強制某些鏈接路徑重新加載的最佳方式

喜歡的東西:

$locationProvider.html5Mode(true) 
$routeProvider.when("/@:id", 
    # window.location.href = [the link's url] 
    # all others are handled by typical controller/view 

我已經能夠解決使用一個錨標記屬性/指令的問題,但我想在URL路由層做到這一點。

+0

這不是一個真正的回答你的問題,但作爲http://stackoverflow.com/a建議您可以添加'目標=「_自我」'你的鏈接/2248275分之19257277 – 2013-11-22 15:29:44

回答

0

我不知道這是否是最好的解決辦法,但你可以根據當前的時間,而不是「/ @」代碼

例如設置的參數

<a href="/Customer/Edit/{{customer.id}}&refresh={{now}}">{{customer.Name}}</a> 

其中 '現在' 是在$ rootScope每個$ routeChangeSuccess

$rootScope.$on('$routeChangeSuccess', function (event, current, previous) { 
$rootScope.now = Date.now(); 
}); 

此設置後可能會有所改善,但它的工作。

您也可以看看到angularjs - refresh when clicked on link with actual url