0

I want to display images in a list which are fetched from firebase database and firebase storage. Following is my code, when I run it browser got unresponsive. Please help me to fix this.

HTML:
<div class="w3-panel" *ngFor="let item of items;">
  <img  [src]="getImage(image.imageUrl)"/>
</div>


JS : my.component.ts

// imageUrl = question/1/ch1/image.jpg   // sample imageUrl format

getImage(imageUrl){
    return new Promise((resolve,reject) =>{
       this.storage.ref(imageUrl).getDownloadURL().then(url => {
               resolve(url);
          })
    });
}
PARAMANANDA PRADHAN
  • 1,104
  • 1
  • 14
  • 23
  • You have created an infinite loop :) Don't call function in template, fetch the images in the component, and then display with variables in the template instead to avoid this. – AT82 May 08 '17 at 19:00
  • http://stackoverflow.com/questions/37876533/ngfor-running-an-infinite-loop-in-angular2 – AT82 May 08 '17 at 19:01

0 Answers0