我想以 Angular 显示 B64 图像字符串。当我放置静态图像字符串时,它会显示,但是当图像是动态时,它会显示一些问题 下面是我的 component.ts 代码
this.Socket_io = socketIo('http://192.168.0.109:3011');
this.Socket_io.on('echo', (obj) => {
var a = JSON.parse(obj)
this.img = a.image_path;
this.image_path = this.sanitizer.bypassSecurityTrustResourceUrl('data:image/jpg;base64,'
+ this.img);
下面是我的html
<img [src]="image_path">
最佳答案
尝试这样
<img [src]="image_path">
这里是 stackblitz https://stackblitz.com/edit/angular-view-image?file=src/app/app.component.html
关于node.js - B64图像不以 Angular 显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58967838/