Infinite scroll showing error


#1

hi I am new in Ionic 2,
I am doing infinite scroll for loading list and showing error “ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘push’ of undefined”,
please help

i am getting values from my API like [{…} , {…} , {…} , {…} , {…}]
here is my code:
in html:

<ion-card *ngFor="let item of paneList">......<</ion-card>


<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
    <ion-infinite-scroll-content></ion-infinite-scroll-content>
  </ion-infinite-scroll>

in .ts:

panellist: any;

constructor{
for (let i = 0; i < 30; i++) {
      this.paneList.push(this.paneList.length);
    }
}

 AttendancePanelist() {

    return new Promise((resolve) => {
      this.storage.get('token').then((value) => {
        this.userProvider.attendancePane(this.user.Email, this.dateToday, this.corporateId).then(data => {
          console.log('list : ' + JSON.stringify(JSON.parse(JSON.stringify(data)).AttendancePane))
        this.paneList = JSON.parse(JSON.stringify(JSON.parse(JSON.stringify(data)).AttendancePane));
          resolve(true);

        });
      });

    })
  }
}

doInfinite(infiniteScroll) {
    console.log('Begin async operation');

    setTimeout(() => {
      for (let i = 0; i < 30; i++) {
        this.paneList.push( this.paneList.length );
      }

      console.log('Async operation has ended');
      infiniteScroll.complete();
    }, 500);
  }