# IOS infinite-scroll doesn't load data

**URL:** <https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286>\
**Category:** ionic-v1\
**Created:** [October 17, 2016, 11:33pm UTC](https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286 "2016-10-17T23:33:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebrarislami](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ebrarislami](https://forum.ionicframework.com/u/ebrarislami)\
**Post date:** [October 17, 2016, 11:33pm UTC](https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286/1 "2016-10-17T23:33:44Z")

</div>

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;
       });
      }
    }
```

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [October 18, 2016, 1:12pm UTC](https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286/2 "2016-10-18T13:12:27Z")

</div>

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 😉

Btw. you should create a service for API communication

---

<div class="post-metadata">

**Author:** ![ebrarislami](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ebrarislami](https://forum.ionicframework.com/u/ebrarislami)\
**Post date:** [October 18, 2016, 11:05pm UTC](https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286/3 "2016-10-18T23:05:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [October 19, 2016, 5:48am UTC](https://forum.ionicframework.com/t/ios-infinite-scroll-doesnt-load-data/67286/4 "2016-10-19T05:48:58Z")

</div>

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?
