I can't seem to be able to get a download url for an image in storage based on filename.
Correction, I can, but i can't seem to get the variable out of the function. Eg. My code:
public getVenueImage(image: string){
let imgUrl: string;
try{
this.firebase.storage().ref().child("/venues/" + image ).getDownloadURL().then(function(url){
imgUrl = url;
console.log("log1: " + url);
});
}
catch(e){
console.log(e);
}
console.log("log2: " + imgUrl);
return imgUrl;
}
Log2: undefined
Any reason why I can't get the image link to return?