The ionInfiniteScroll directive, broadcast in main contrller doesn't trigger the directive $on enent


#1

ionInfiniteScroll source code:

      $scope.$on('scroll.infiniteScrollComplete', function() {
        $element[0].classList.remove('active');
        $timeout(function() {
          scrollView.resize();
        }, 0, false);
        infiniteScrollCtrl.isLoading = false;
      });

But in my controller, it doesn’t work.

<a href="javascript:;" ng-click="complete()">Manaul Complete</a>
starter.controller('Home', function($scope) {
   $scope.complete = function(){
      $scope.$broadcast('scroll.infiniteScrollComplete');
   }
})

But the ionInfiniteScroll callback function can work:

        <ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="onInfiniteScroll()" distance="5%">
        </ion-infinite-scroll>
$scope.onInfiniteScroll = function() {
   ...
   $scope.$broadcast('scroll.infiniteScrollComplete');
}

#2

Hi @Lagoonwish,

Can you show us the markup for that whole page? Specifically, where is your controller defined.


#3

There are two tab in one page, the ionInfiniteScroll for the init list is Ok, and infiniteScrollCtrl.isLoading will be true when scroll overed, but when I change to the another tab, the infiniteScrollCtrl.isLoading will still be true, So I want to change it to false manuall. But it just can’t do that.


#4

Andy was asking about the code code for that whole page rather than a screenshot. Can you setup a CodePen sample?