IOS infinite-scroll doesn't load data

Hi, i have a problem with infinite scroll in my app. my code works on android but not on iphone. On iphone when i scroll down it doesnt load data and keeps loading…
ion-infinite-scroll distance=“1%” on-infinite=“loadMoreCategoryQuestions()” ng-if="!moredata"></ion-infinite-scroll

   $scope.byCategory = function(id){
      $scope.catpage = 1;
      $scope.catID = id;
      //$scope.moredata = true;
      $http.get($rootScope.url+'category/'+id+'/questions/v1?page=0').then(function(response){
        $scope.LimitC = response.data.totalElements;
        if($scope.limitC > 10){
          $scope.moredata = false;
        }
        $scope.categoryQuestions = response.data.content;
        $scope.categoryQuestionModal.show();
        console.log($scope.LimitC);
        console.log($scope.moredata);
      });

      $scope.loadMoreCategoryQuestions = function(){
        console.log("YES");
        $http.get($rootScope.url+'category/'+$scope.catID+'/questions/v1?page='+$scope.catpage).then(function(response) {
        console.log("LImit IS:"+$scope.LimitC);
        console.log($scope.catpage);

        console.log(response.data.content.length);
        $scope.categoryQuestions = $scope.categoryQuestions.concat(response.data.content);
        if($scope.categoryQuestions.length >= $scope.LimitC){
          $scope.moredata = true;
        }

         $scope.$broadcast('scroll.infiniteScrollComplete');
         $scope.catpage = $scope.catpage+1;
       });
      }
    }

i would say your requests fails and you do not have any error handling…

then() can take a second callback function for error handling --> check if any error occurs :wink:

Btw. you should create a service for API communication

I implemented error handling, there is no error. I checked url in postman it works well. I set $scope.moredata = false so it should trigger loadMore function but it doesn’t. It works only when i open app first login then go to my category questions and it doesn’t work. when i sign out then login again it works. It doesn’t load in first login but after reload it works. BTW this is only for iPhone, on android it works just fine.

why are you define your loadMore function inside of the “byCategory” function?

I think the loadMore function would be enough for loading the first page and every page after.

Are there some errors in the JavaScript console in the WebDev Tools in chrome or firefox?