How To Retrieve Image's Url From Firebase's Storage?
I have this code straight from the documentation of Firebase : // Create a reference to the file we want to download var user = firebase.auth().currentUser.uid; var storageRef
Solution 1:
Just put your result inside a variable of your controller and in ng-src on the HTML.
The best would be to use a service to get the URL and not directly in the controller.
Controller
app.controller('MyController', ['$scope', function($scope) {
// Create a reference to the file we want to download
var user = firebase.auth().currentUser.uid;
var starsRef = storageRef.child('/' + user + '/profilePicture/' + file.name);
// Get the download URL
starsRef.getDownloadURL().then(function(url) {
// Insert url into an <img> tag to "download"
$scope.imageUrl = url;
});
}]);
HTML
<img ng-src="{{imageUrl}}"/>
Post a Comment for "How To Retrieve Image's Url From Firebase's Storage?"