AngularJS HTML5路由启用:传递URL回到服务器? [英] AngularJS HTML5 Routing Enabled : Passing URL Back to server?

查看:74
本文介绍了AngularJS HTML5路由启用:传递URL回到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AngularJS SPA与Html5Mode启用。我从我的网址删除了哈希和除了一个问题,一切都很正常。我们的网站有通过HTTPGET调用一个MVC控制器的方法从服务器下载文件的下载链接。角不再经过的路由返回到服务器,因为它认为它需要处理它。我如何告诉角的路由引擎传递回到服务器?我已经考虑切换下载到的WebAPI,但我看这种方法不同的结果。

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.

谢谢!

推荐答案

我想它了! :)该解决方案是增加目标='_自我'到您的锚标记。任何其他目标值的工作太; _blank,_top等。我在IE 9,10测试这一点;铬40-43,25-29歌剧和Safari 5.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

这篇关于AngularJS HTML5路由启用:传递URL回到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆