回答者 - /sf/users/144494451/
$http({method: 'GET', url: '/someUrl'}).
success(function(data, status, headers, config) {
var anchor = angular.element('<a/>');
anchor.attr({
href: 'data:attachment/csv;charset=utf-8,' + encodeURI(data),
target: '_blank',
download: 'filename.csv'
})[0].click();
}).
error(function(data, status, headers, config) {
// if there's an error you should see it here
});
Run Code Online (Sandbox Code Playgroud)
我实现了这个解决方案,使用angular从服务器下载文件到客户端.这在Google Chrome中完美运行.但是这个解决方案在Mozilla Firefox中不起作用.
谢谢