Q:

get data is undefined ionic2

I want to get data json to show listpage but http.get is undefined  
I want to set this.fff to this.foundRepos[i].se
thanks for your help. :)
  for(var i=0;i<this.foundRepos.length;i++){
            if(!this.foundRepos[i].search.isbn){
              this.foundRepos[i].se = "assets/read3.png";
            }
            if(this.foundRepos[i].search.isbn){
              this.foundRepos[i].se = this.foundRepos[i].search.isbn;
this.api.getImage(this.foundRepos[i].se).subscribe(
            data => {

              this.fff = data.json();
            },
            err => console.error(err),
            () => console.log('completed')
          );
            this.foundRepos[i].se = this.fff; <---this undefined
        }
              }

listpage.html

<ion-item text-wrap *ngFor="let item of  foundRepos" (click)="goToDetails(item)">
  <p>{{ item.type }}</p>
  <ion-thumbnail item-left>
    <img src="{{item.se}}">
</ion-thumbnail>

A:

When I tested it with the for loop, I came to the conclusion that i always is the length of the array inside the subscription, no matter where in the iteration we are. I'm not entirely sure why, so someone smarter, please enlighten me! :)
What seemed to work well was to use forEach or change the looping to something like this:
for(let x of this.foundRepos)

So please try the following, where x obviously is the whole current object from the array:
for(let x of this.foundRepos) {
   if(!x.search.isbn) {
      x.se = 'assets/read3.png';
   }
   if(x.search.isbn) {
      x.se = x.search.isbn;
      this.api.getImage(x.se)
        .subscribe( data => {
           x.se = data.json();
        });
   }
}

