I'm attempting to showcase an image from Firebase storage using the following code:
Inside my component :
findImg(img) {
this.storage.ref('/img/' + img).getDownloadURL().subscribe(
result => {
console.log(result);
}
)
In my template :
<ion-header>
<ion-toolbar>
<ion-title>La gamme : {{collectionName}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-card *ngFor="let pro of product | async">
<ion-card-header>
<ion-card-title>{{pro.name}}</ion-card-title>
</ion-card-header>
<ion-card-content>
<p>{{pro.img}}</p>
<div *ngIf="findImg(pro.img)"></div>
</ion-card-content>
</ion-card>
</ion-content>
pro.img represents the field "img" in my product database and the name of its corresponding image in storage.
Everything is working fine except for the ngIf-div. The console displays the result correctly but it seems to loop endlessly, causing Chrome to crash. I can't figure out why the loop never stops.