我正在尝试使用 bypassSecurityTrustResourceUrl 解析图像,但在输出中我得到了
SafeValue must use [property]=binding: data:image/jpeg;base64,(actual data) (see http://g.co/ng/security#xss)
如下图所示
这是我的代码
loadImages(): void {
this.projectsDetailService.getById(this.param_id).
subscribe((data: any) => {
console.log("Step 1")
this.projectList = data;
for (var index in this.projectList) {
this.images = this.projectList[index].img;
this.objectURL = 'data:image/jpeg;base64,' + this.images;
this.thumbnail1 = this.sanitizer.bypassSecurityTrustResourceUrl(this.objectURL);
this.projectList[index].img = this.thumbnail1;
console.log("Data is "+this.thumbnail1);
}
}
);
}
即使我想在 html 文件中使用它,我也收到以下错误