Reputation: 251
<div *ngFor="let el of list">
<img [src]='el.photo'
</div>
Api retturn el.photo = '/9j/2wBDAAMCAgMCAgMDAw......'
and i want concatante with
data:image/jpeg;base64,
something like that
<img [src]='data:image/jpeg;base64, + 'el.photo''>
Upvotes: 0
Views: 948
Reputation: 10148
You can use
<img src={{'data:image/jpeg;base64, + el.photo}}>
Upvotes: 1
Reputation: 527
Firstable it would be
<img [src]="'data:image/jpeg;base64,' + el.photo">
But I suppose it was only a mistake. However I would suggest you to make concatenations like this in controller and not in view (as a part of good coding practices). You can eg. make a function which would return concatenated string in controller:
function getBase64ImageSrc(photo) {
return 'data:image/jpeg;base64,' + photo;
}
And then use this function in view:
<img [src]="getBase64ImageSrc(el.photo)">
Upvotes: 3