I use openfb-angular (Facebook API library) to get me / image .Returned data: "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 does not work, and I get an empty img tag.
img
Where is my mistake?
Use the ng-source directive as follows:
<img ng-src="{{'data:image/png;base64,'+main.user.imageData}}" >
Hope this helps.
Use the data-ng-src directive as <img data-ng-src="{{data.image_url}}"> .
data-ng-src
<img data-ng-src="{{data.image_url}}">
In your controller, set the base64 string as follows: $scope.data.image_url=<your base64 image source>
$scope.data.image_url=<your base64 image source>
Hope this helps!
<img data-ng-src="data:image/png;base64,{{main.user.imageData}}"/>
In Angular 6, this will be:
<img [src]="data:image/png;base64, + main.user.imageData"/>
Source: https://habr.com/ru/post/1209838/More articles:How to get element name of UIViewControl object from storyboard - iosReading sqlite data at transaction start (Android) - androidHow to write a custom feeder for a json rest pattern - load-testingUnderscore in javascript function parameter - javascriptJavascript connector for an array of DOM elements - javascriptHow to run a bash script file in a chef? - fileIs this an Android Studio bug or am I mistaken? - androidHow to list files using the sort command, but not the ls -lrt command - linuxAzure bootstrap fonts - c #The confusing result of page error counting on Linux - linuxAll Articles