how to convert byte array to image in Angular2

丶灬走出姿态 提交于 2020-01-03 02:22:09

问题


I am getting byte array from api and i have applied image tag on my HTML page as <img src="data:{{model.asd_logo_type}};base64,{{model.dfgh_logo}}" alt="...">

but i am not able to get the image on display.

Please suggest what can i do.


回答1:


you can use src directive to display image in angular

<img [src]="'data:image/jpeg;base64,'+model.dfgh_logo" />

This is how I achieved. model.dfgh_logo this should have image in byte array.



来源:https://stackoverflow.com/questions/48781966/how-to-convert-byte-array-to-image-in-angular2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!