2016-05-18 98 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