AngularJS – Show byte array content as image

Use ng-src in the following format

<img ng-src="data:image/JPEG;base64,{{image}}">

Don’t forget to add a sanitization filter for data to not be marked as unsafe by angular:

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ftp|blob):|data:image\//);

Leave a Comment