0
我从MongoDB获取图像。现在我想通过代码将图像下载到我的系统中。从角度js下载图像
从这个代码我得到的对象: $ scope.clickEvent =功能(X){
var path = x.path.replace('uploads','');
$http({
method: 'GET',
url: $API_URL + path,
headers: {
"Authorization": $localStorage.currentUser.token
}
}).then(function (response) {
var file = new Blob([response.data], {type: 'application/Image'});
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
console.log("Result: " + response.data);
});
};
得到了答案。谢谢。 –