Angular 5 - Como exibir uma imagem em HTML que sai como saída de um http POS
Preciso exibir uma miniatura / imagem proveniente de uma solicitação POST
Postman mostra a saída da maneira correta
Estou tentando usar o mesmo no componente Angular, mas não é exibido. Console mostra texto / binário.
html
<img src="{{turl}}" />
Component.ts
turl : any
getThumbnail() : void {
this.azureblobService.getBlobThumbnail()
.subscribe(
(val) => {
console.log("POST call - getThumbnail- successful value returned in body",
val);
this.turl = val; //<====== Set value here
},
response => {
console.log("POST call - getThumbnail - in error", response);
},
() => {
console.log("The POST - getThumbnail - observable is now completed.");
});
}
Serviç
getBlobThumbnail() {
console.log("....AzureblobService.getBlobThumbnail()");
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Accept' : 'application/json',
'Ocp-Apim-Subscription-Key' : 'xxxxxxx'
});
return this.http.post(this.thumbnailFetchUrl,
JSON.stringify({
responseType: "blob",
"url": "http://xxxx.blob.core.windows.net/acsazurecontainer/Git-Logo-1788C.png",
}), {headers: headers});
}
Aprecie alguma ajuda?