I am facing an issue with ion-infinite-scroll in my Ionic2 application. Please find the below code.
Code
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="Loading more data...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
doInfinite() method
doInfinite(infiniteScroll:any){
if(this.myReportList.length < this.reportCount){
console.log("Inside doInfinite if");
this.loadMore=true;
this.startFrom = this.endTo+1; // for the time time the value of startFrom is 0 and endTo is 10.
this.endTo = this.endTo+10;
this.viewMyReports();
}else{
console.log("Inside doInfinite else");
this.loadMore=false;
this.genericService.showToast("Reached Bottom")
}
infiniteScroll.complete();
}
Issue is doInfinite() method is invoked more than one for a single scroll . this.viewMyReports();
is the web service from where I am getting response . Please help me with this issue
Thanks in advance