On-infinite-scroll function gets invoked many many times

Hi everybody,
im trying to integrate a infinite-scroll into a view
my content looks like

  <ion-content  on-infinite-scroll="nextItems()">

                 <a class="item item-icon-left" ng-repeat="article in articles | limitTo: scroll.limitVisible  track by article.id" 
                  <i class="icon ion-pricetag"></i>
                <ion-infinite-scroll ></ion-infinite-scroll>

The next items function :

$scope.nextItems = function() {

    console.log('loading next items', $scope.scroll.limitVisible ,  $scope.articles.length);
    if ($scope.scroll.limitVisible < $scope.articles.length && $scope.scroll.moreArticlesLoaded) {
        $scope.scroll.limitVisible = $scope.scroll.limitVisible+ 50;
        console.log('done ',$scope.scroll.limitVisible);
    else {
        console.log('no more items to load');


The problem is that the nextItems functions gets invoked many many times until angularJS stops with

Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!

Event there is no

<ion-infinite-scroll ></ion-infinite-scroll>

in my view the nextItems gets invoked very often

Need some help please


You should consider using nightly if you want to use infinite-scroll. There were a lot of changes and fixes lately. See http://codepen.io/elm/pen/Becqp how to use infinite scroll with nightly.

EDIT: The ng-if on ion-infinite-scroll should work for you too.

1 Like

Thx for the fast answer,

do you know when the fixes will be released official ?

No I don’t know the release plan. The next version v0.10.0-alpha will contain the changes.

Switched to current nightly
works great
Thx for the help

bear in mind that this approach doesn’t work if you have more then one ion-content. Or it will work for one content only.

I really don’t know why they use scope: true, instead isolate one.

In my case I use one controller and switch ion-content with ng-show.

1 Like