2014-10-07 16 views
0

我目前正試圖設置一個表,當您單擊一行時轉到配置文件頁面。但$ location.url會簡單地將'profile.html'附加到當前html頁面的末尾,而不會將我帶到配置文件頁面。如何更改當前網址以允許我訪問我的網頁。

指數HTML:

http://localhost:9080/AgentOnlineApp/index.html 

HTML當我點擊該行我得到:

http://localhost:9080/AgentOnlineApp/index.html#/profile.html

我想:

http://localhost:9080/AgentOnlineApp/profile.html

當前AngularJS代碼:

$scope.selectTableRow = function(agent) 
    { 

     $location.url('/profile.html'); 

    } 

回答

0

API,你需要設置:

$locationProvider.html5Mode(true); 

如果你真的想要陳完全重新定位位置並重新加載頁面,因爲這不會是一個單獨的頁面應用程序,所以您沒有充分使用Angular。但是,您可以使用window.location = "profile.html"

1

你可能想試試這個加載另一個頁面(應用程序之外):

$window.location.replace("profile.html")

如果你想使用HTML5歷史不要忘記注入$window