so i need to enable the ion-infinite-scroll from other function rather than its output emited (ionInfinite)=doInfinite($event)
my html for infinite scroll, notice that we pass $event instead of #infiniteScroll, its wierd, we usually pass the instance of #
<ion-infinite-scroll #infiniteScroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content>LLoading</ion-infinite-scroll-content>
</ion-infinite-scroll>
this is the doInfitinet output emit callback
// ionInfinite output emited
// this will disable infinitescroll if pagination is completed
public doInfinite(infinite:InfiniteScroll){
if(this.visitationData.length >= (this.visitationData[0].maxpage)) {
infinite.enable(false);
}else{
infinite.enable(true);
this.getVisitation(this.visitationData.length+1).then(data=>{
if(data){
infinite.complete();
}
});
}
}
this is the other function, Notice the comment in the code, that line generate error
@ViewChild('infiniteScroll') public infiniteScroll:InfiniteScroll;
public filterChanged() {
console.log(this.filter);
this.visitationData = [];
// this.infiniteScroll.enable(true) <-- this calling method is from ViewChild, this line generate error
this.getVisitation();
}
the error generated says, which mean its not a Infinite scroll
TypeError: this.infiniteScroll.enable is not a function
please help me