firebase - In AngularFire how do we get storage reference like in normal javascript? -


by using normal javascript can use firebase storage code below

var config = {     apikey: "aizasycj3rdrcdo_zph5dkpn-rlmjsr5fbd7s5w",     authdomain: "myapp-90faa.firebaseapp.com",     databaseurl: "https://myapp-90faa.firebaseio.com",     storagebucket: "myapp-90faa.appspot.com", };  firebase.initializeapp(config);  // file event e var file = e.target.files[0]; var storage = firebase.storage().ref('images/'+file.name); var task = storage.put(file); 

but how achive storage object in angular fire? here can refer database:

var myapp = angular.module('myapp', ['firebase']); var myproducts = new firebase('https://myapp-90faa.firebaseio.com/products');  myapp.controller('productsctrl', ['$scope', '$firebasearray', function($scope,$firebasearray) { 

for angularjs has been possible since version 2.3 of angularfire:

app.controller("myctrl", ["$scope", "$firebasestorage",     function($scope, $firebasestorage) {         var storageref = firebase.storage().ref("images/dog");         $scope.storage = $firebasestorage(storageref);     } ]); 

for angular beyond version 1.x, angularfire2 has api firebase storage:

constructor(private fb: firebaseapp) {     const storageref = fb.storage().ref("images/dog") } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -