I want to display a byte array as an image using AngularJS. The byte array is sent from the server to the angularJS. And when I try to display it using this HTML code:
<img ng-src="data:image/JPEG;base64,{{photos[0].photo}}">
AngularJS :
$scope.getGallery = function() {
$http.get('gallery/'+$stateParams.id).success(function(data){
console.log(data);
$scope.photos = data;
}).error(function(data) {
alert("Bad");
});
};`
It just shows me an icon of an empty image. This what it shows when I inspect the icon whith the browser :
<img ng-src="data:image/JPEG;base64,STUwNGU0NzBkMGExYTBhMDAwMDAwMGQ0OMThlOTRiMTVjNzA2OTZhNzQ0MDk0YTEyNDM4YWUyMDNhOWZjNThiZmFjMjg0Z...yNjA4Mg==">