我需要将响应类型设置为角度为'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);
Run Code Online (Sandbox Code Playgroud)
Nar*_*yan 14
angular为此提供配置对象,检查文档
$http({
url: "http://localhost:8080/example/teste",
method: "POST",
responseType: "blob"
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10116 次 |
| 最近记录: |