我正在尝试在Ionic 3项目中显示从Firebase存储获得的URL。我在尝试获取标记中[src]的URL时遇到问题。我试图以字符串形式显示URL,但是没有任何结果。当我尝试console.log字符串时,控制台中也没有显示任何内容。
这是我的代码:
。html:
<ion-img class="imgBooking" [src]=retrievedRestaurantImage item-content></ion-img>
。ts:
retrievedRestaurantImage:any;
...
var storage = firebase.storage();
var pathReference = storage.ref('Restaurant/ABC_Restaurant/ABCRestaurantPicture.jpg');
pathReference.getDownloadURL().then(function(url){
console.log(url); <-- This URL appears in the console, and after clicking on the link, it directs me to the correct picture.
this.retrievedRestaurantImage = url;
console.log(this.retrievedRestaurantImage); <-- Does not display in console, image is not updated in the <ion-img> tag.
}).catch(function(error) {
// Handle any errors
});
当我单击控制台中的URL时,它会将我定向到正确的映像(来自Firebase存储)。
我似乎无法显示图像。请帮助!
我正在尝试在Ionic 3项目中显示从Firebase存储获得的URL。我在尝试获取标记中[src]的URL时遇到问题。我试图以...
更改此: