I'm using openfb-angular (Facebook API library) to get me/picture.
The return data is "url" contains Base64 data here is the facebook documentation.
Here is my code:
JS
OpenFB.get('/me/picture', {format: 'json'}).success(function (imgData)
{
$scope.main.user.imageData = imgData;
});
HTML
<img ng-src="data:image/jpg;base64,{{main.user.imageData}}">
It's not working and I get an empty img
tag.
Where is my mistake?
Use ng-source directive like this:
<img ng-src="{{'data:image/png;base64,'+main.user.imageData}}" >
Hope this helps.
Use data-ng-src
directive like this <img data-ng-src="{{data.image_url}}">
.
In your controller set base64 string as this:
$scope.data.image_url=<your base64 image source>
Hope this helps!
<img data-ng-src="data:image/png;base64,{{main.user.imageData}}"/>
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With