When is it called twice, on page load? there’s also a strange bug with pull to refresh that keeps firing if the event hasn’t ended before you leave the view as described in this issue https://github.com/driftyco/ionic/issues/2771
i also had that it was called twice on page load so i set up a boolean to check if it was allready fired code sample:
And when you call loadmore you set moredata to false and after that you set it to true which would cause the inifinte scroll to dissappear and reappear and when it reappears it will probably instantly run the function again.
Thank you! immediate-check=“false” fixed this issue for me.
I also had to add something like ng-if=“!endOfList && items && items.length > 0” to the infinite scroll to prevent it from firing over and and over and over again when I have an empty list or reached the end of the list.
To prevent the infinite-scroll event to keep on firing when there is no more content to load, use ng-if (as described in the official documentation Ionic infinite scroll
Hi @Claas, @sjerd solution is correct, one extra thing you can do is put $scope.$broadcast in timeout function like this.
$timeout(function () {
$scope.$broadcast('scroll.infiniteScrollComplete');
}, 1000);
//html
</ion-list> // end of list
<ion-infinite-scroll on-infinite="vm.loadMore()" ></ion-infinite-scroll>