angularjs - Ionic view doesn't render ng-repeat with fetched data from API -


i trying display list of data fetched api. when page loads says errors array undefined. console prints array.

here have done far.

update.html

<ion-item ng-repeat="e in errorlist">       <ion-label>{{e.name}}</ion-label>       <ion-radio value=""></ion-radio> </ion-item> 

i have tried sending nav params. calling fetching function on constructor , ionviewwillenter()

update.ts

export class aboutpage {   errorlist: any;   error: string;   errors: {};   nav: navcontroller;  constructor(public navctrl: navcontroller, public navparams: navparams, private errorservice: errorserviceprovider) {   this.nav = navctrl;   this.error = "";   this.errors = this.navparams.get('errors');   this.errorlist = [];  }  ionviewwillenter() {   this.fetcherrors(); }  fetcherrors() {   this.errorservice.geterrors()    .then(data => {      this.errorlist = data;      console.log(this.errorlist); });  }  selecterror() {     console.log(this.errors);     console.log(this.errorlist);   } } 

you doing silly mistake here, instead of ng-repeat use ngfor since angular, use elvis operator check value present

<ion-item ngfor="let e in errorlist">       <ion-label>{{e?.name}}</ion-label>       <ion-radio value=""></ion-radio> </ion-item> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -