I am using ionic infinite scroll to load data from php api service.
The problem is The method defined on the on-infinite property (ie loadmore function) is called multiple times when it reaches the bottom.
Here is my code
<div class="card" ng-repeat="result in results">
<div>{{result.name}}</div>
</div>
<ion-infinite-scroll immediate-check="false" on-infinite="loadMore()" distance="10%" ng-if="!noMoreItemsAvailable"></ion-infinite-scroll>
Here is my controller js
$scope.loadMore=function(){
console.log("Load more item clicked");
//get data from api service
$http.get(url+').then(function(msg){
$scope.results=$scope.results.concat(msg.data)
});
};
I will get the console message Load more item clicked
multiple times when it reaches the bottom sometimes it become infinite times.
Does anyone know why it is happen?