0

I'm trying to display my fetched remote data, from IonicPage to template view using ng-repeat.

How to display my fetched remote data into ionic html view?

Running Ionic-4. I’ve tried to log fetched remote data, web call is ok. It seems template-view load before fetched-remote-data.

1 - Following method load data

  public onLoadData(){
    this.http.get(this.cfg.fetchPlatformUrl()).subscribe((data: any) => {
      this.remoteData = data;
    });
  }

2 - Following method get data from IonicPage variable

public getRemoteExerciseData(){
    return this.exerciseVideos;      
  }

3 - its template view code does not listing as i expected.

  <ion-list>
    <ion-list-header>
      <ion-label>
         <b>Exercise List</b></i>
      </ion-label>  
    </ion-list-header>

    <!-- START - ISSUE IDENTIFIER -->
      <ion-item ng-repeat="ex in getRemoteExerciseData()">
          Video 1
          <ion-chip color="success">
              <ion-label>V</ion-label>
              <ion-icon name="happy" color="success"></ion-icon>
          </ion-chip>
          <ion-chip color="danger">
              <ion-label>X</ion-label>
              <ion-icon name="sad" color="danger"></ion-icon>
          </ion-chip>
      </ion-item>
    <!-- END - ISSUE IDENTIFIER -->
  </ion-list>

I expect see the list of fetched remote data, but the actual template view show only one.

2 Answers 2

1

Exercise List

<!-- START - ISSUE IDENTIFIER -->
  <ion-item *ngFor="ex in getRemoteExerciseData()">
      Video 1
      <ion-chip color="success">
          <ion-label>V</ion-label>
          <ion-icon name="happy" color="success"></ion-icon>
      </ion-chip>
      <ion-chip color="danger">
          <ion-label>X</ion-label>
          <ion-icon name="sad" color="danger"></ion-icon>
      </ion-chip>
  </ion-item>
<!-- END - ISSUE IDENTIFIER -->

Sign up to request clarification or add additional context in comments.

Comments

0

For latests Angular versions, you should use ngFor

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.