【发布时间】:2018-01-25 20:42:30
【问题描述】:
无法显示我的图像。知道我做错了什么吗?
<img style="width:175px" [src]="imageToShow">
getImage(){
this.mccProgramService.getImageFromService().subscribe(
(res) => {
console.log(res);
this.imageToShow = res;
// window.open(fileURL);
}
);
}
getImageFromService() {
return this._httpClient.get("http://localhost:9080/mccr/api/file/download.action?contentFileId=11", {observe: 'response', responseType: 'blob'})
.map((res) => {
return new Blob([res.body], {type: res.headers.get('Content-Type')});
})
}
数据从服务中返回
<<other headers>>
<<Content-Type header>>
<<other headers>>
<<file binary data>>
【问题讨论】:
标签: angular