【发布时间】:2017-04-20 23:57:05
【问题描述】:
您好,我在尝试每种解决方案后都感到疲倦,但无法使其发挥作用。
我在 Angular 中的 http 调用是
$http({
method: 'GET',
url: API_URL + 'v1/file/' + candidateId + '/download',
headers: {
'authToken': AuthService.getToken(),
},
responseType: 'arraybuffer'
})
.then(function onSuccess(response) {
successCallback(response);
},
function onError(response) {
errorCallback(response);
});
并且这段代码成功
vm.onSuccessDownloadResume = function(response) {
var blob = new Blob([response.data], {type: response.headers('content-type')});
var objectUrl = URL.createObjectURL(blob);
window.open(objectUrl);
};
我尝试了 webkitURL.createObjectURL(blob),它仅适用于 chrome,但 URL.createObject 根本不起作用。
收到消息 URL.createObjectURL() 不是函数()
谢谢
【问题讨论】:
标签: javascript angularjs url