I am new to angularjs. I am trying to call a function by using ng-change
. When I add a image then ng-change
function is not calling and also if I upload an image in Firebase how can i get that image again.
What I want is first I have upload an image to firebase storage bucket then I want to show that image in html using src
tag
here is my html code:
<input name="menuPic" accept="image/png, image/gif, image/jpeg" type="file" ng-model="menuImage" ng-change="uploadImage(menuImage)">
<button ng-click="getImage()">getImage</button>
here is my js code:
$scope.uploadImage=function(menuImage){
console.log(menuImage); \\here image file is not coming
console.log(menuImage.files); \\here image file is not coming
firebase.storage().ref("Rest/"+menuImage.filename).put(menuImage.file);
}
$scope.getImage=function(){
firebase.storage().ref("Rest/").once('value',function(snap){
console.log(snap); \\ when iam trying to get the image it showing error like(.once is not a function)
})
}
Thanks in advance