AngularJS HTML5 Routing Enabled : Passing URL Back to server?

别等时光非礼了梦想. 提交于 2020-02-25 09:09:27

问题


I have an AngularJS SPA with Html5Mode enabled. I removed the hashes from my URLS and everything works great except for one issue. Our site has download links for downloading documents from the server via a HTTPGET call to a MVC controller method. Angular no longer passes the route back to the server because it thinks it needs to handle it. How do I tell Angular's routing engine to pass the GET back to the server? I have considered switching the download to a WebAPI, but I read mixed results with this approach.

Thanks!


回答1:


I figured it out! :) The solution is to add target='_self' to your anchor tag. Any of the other target values work too; "_blank", "_top" and so on. I tested this in IE 9, 10; Chrome 40-43, Opera 25-29, and Safari 5.1



来源:https://stackoverflow.com/questions/30572207/angularjs-html5-routing-enabled-passing-url-back-to-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!