Show images in cards from bytes

Hi. I’d like to show an image from an array of bytes. I tried this code but it doesn’t work:

<ion-card *ngFor="let result of results">
      <img ng-src="data:image/JPEG;base64,{{result.arrayofbytes}}"/>

Static files must not be public in my application, so I don’t need something like this:

<img src=""/>

Any ideas?

1 Like

Your problem is with ng-src, that’s Angular 1 syntax. Here’s the Angular 2 syntax:

<img [src]="'data:image/JPEG;base64,' + result.arrayofbytes" />
1 Like

It works, thank you!