Images retrieve by use *ngFor


#1

hi i need a big solution for this, i have using ionic 2 and angular 2 .i get a image from url .when if it is multiple value i could get the value so pls give me a solution
its html:

Choose Date :

        <ion-datetime displayFormat="DD/MMM/YYYY"    [(ngModel)]="selected_date"></ion-datetime>          
</ion-item>

<button ion-button full (click)=“GethomeWorkbut()”>GET HOMEWORK

Date {{x.date}} Subject {{x.subject}} Description {{x.description}}
      <audio-track-play dark [audioTrack]="audio"><ion-spinner></ion-spinner></audio-track-play>  
    </ion-thumbnail>
   
    <div item-content style="width:100%">
      <audio-track-progress-bar dark duration progress [audioTrack]="audio" [ngStyle]="{visibility: audio.completed > 0 ? 'visible' : 'hidden'}"></audio-track-progress-bar>
    </div>
  </ion-item>    
</audio-track>
Image & Audio
</ion-list> 


</div>

ts:

download1(y) {
console.log(y)
this.Audio(y);
this.view_aud=true;
if(this.platform.is(‘android’)){

// this.LoadImage(y);
this.hi(y);
}

}
hi(y){
const fileTransfer: FileTransferObject = this.transfer1.create();
const url = encodeURI(‘http://localhost:8000/’+y.image);
this.img_path1 = cordova.file.externalRootDirectory + ‘DCIM/Homework/’+this.selected_date +’/’;
this.file.checkFile(this.img_path1,y.image).
then((success)=>
//alert(this.img_path1+y.image),
this.imageSrc=this.img_path1+y.image
).
catch(err =>
fileTransfer.download(url,this.img_path1+ y.image,true).then((entry) => {
// alert('download complete: ’ + entry.toURL());
this.imageSrc=entry.toURL();
}, (error) => {
// handle error
})
)
}

Audio(y){
const fileTransfer: FileTransferObject = this.transfer1.create();
const url = encodeURI(‘http://localhost:8000’+y.audio);
this.img_path1 = cordova.file.externalRootDirectory + ‘DCIM/Homework/’+this.selected_date +’/’;
this.file.checkFile(this.img_path1,y.audio).
then((success)=>

// alert(this.img_path1+y.audio),
this.myTracks=[{
  src: this.img_path1+y.audio,
  }]
).
catch(err =>
  fileTransfer.download(url,this.img_path1+ y.audio,true).then((entry) => {
 
     // alert(this.img_path1+y.audio),
this.myTracks=[{
  src:'http://localhost:8000/'+y.audio,
  }]
  }, (error) => {
    // handle error
  })
)

}