如何在AngularJs中将reponseType设置为$http的blob?
发布时间:2020-12-17 06:55:36 所属栏目:安全 来源:网络整理
导读:我需要将响应类型设置为角度为’blob’. 如何在 angularjs中为$http设置响应类型? 下面提供了使用 XMLHttpRequest设置responseType的示例代码.我需要用$http替换XMLHttpRequest. var oMyForm = new FormData();oMyForm.append("js",content);var oReq = new
我需要将响应类型设置为角度为’blob’.
如何在 angularjs中为$http设置响应类型? 下面提供了使用 XMLHttpRequest设置responseType的示例代码.我需要用$http替换XMLHttpRequest. var oMyForm = new FormData(); oMyForm.append("js",content); var oReq = new XMLHttpRequest({mozSystem: true}); oReq.open("POST",url,true); oReq.responseType = "blob"; oReq.onload = function(xhr) { }; oReq.onerror = function(xhr) { }; oReq.send(oMyForm); 解决方法
angular为此提供配置对象,请检查
docs
$http({ url: "http://localhost:8080/example/teste",method: "POST",responseType: "blob" }) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |