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);
});
};
得到了答案。謝謝。 –