2016-05-18 95 views
0

我正在用angularjs路由開發asp.net mvc項目。在重新載入頁面時產生一些路由錯誤。在我的應用程序中,Angularjs路由錯誤

​​

如果我重新加載頁面,此頁面正常工作。但是,如果我重新加載下一頁,它會在'/'應用程序中顯示服務器錯誤。 HTTP:404錯誤。

.when('/computer', { 
     templateUrl: '/Selection_Routing/Selection_Product/Laptop.html', 
     controller: 'LaptopController' 
    }) 

我很感謝你的回答。

+0

可能是舊的回答可以幫助你「 [http://stackoverflow.com/questions/20307655/404-error-with-angularjs-templateurl-routing](http://stackoverflow.com/questions/20307655/404-error-with-angularjs-templateurl-routing) 「 – Ronald

+0

html5Mode是真的嗎? – dfsq

+0

如果您使用Html5Mode,您的服務器需要配置以及角度。你使用什麼服務器技術?編寫UI-Router的人也編寫了一個非常好的常見問題解答,討論了這個問題並給出了很多流行服務器的配置選項:https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#如何配置您的服務器到工作與html5mode – Claies

回答

0

也許這可以幫助「stackoverflow.com/questions/16569841/reloading-the-page-gives-wrong-get-request-with-angularjs-html5-mode」

+0

不,這是我的打字錯誤... – Rubel

+0

編輯答案。如果您啓用了html5mode,該問題應該可以幫助您。 –

+0

$ locationProvider.html5Mode(true).hashPrefix('!');不工作 – Rubel