Ion-infinite-scroll problema with loading


#1

Hi everyone, i’m new here and i have a problem with directive ion-infinite-scroll. To obtain the data this works well, but the problem is that the first time show the loading, but the following times not. What can be the problem?.

My code:

<ion-list>
      <ion-item ng-repeat="survey in surveys" class="list card">
        <div class="item item-avatar">
          <img ng-src="{{ survey.foto }}">
          <h2>{{ survey.user | decode64 }}</h2>
          <p>{{ 'CATEGORY' | translate }}: {{ 'CATEGORY_' + survey.category | translate }}</p>
        </div>
        <div class="item item-body">
          <p>
            {{ survey.title_survey }}
          </p>
          <p>
            <a class="subdued">{{ survey.timestamp | timestampToLocaleString }}</a>
          </p>
        </div>
        <div class="item tabs tabs-secondary tabs-icon-left">
          <a class="tab-item" href="#">
            <i class="ion-help"></i>
            {{ 'SEE' | translate }} {{ 'QUESTIONS' | translate | lowercase }}
          </a>
        </div>
      </ion-item>
</ion-list>

<ion-infinite-scroll
  on-infinite="surveys_data()"
  ng-if="hasMoreSurveys">
</ion-infinite-scroll>

$scope.surveys_data = function(){
    if($scope.hasMoreSurveys){
      var filters = {
        limit: true,
        value_limit: $scope.limit
      };
      var promise = FirebaseArray.find("surveys", filters);
      promise.then(function(obj){
        //Si son iguales es que llego al final
        if(angular.equals($scope.surveys, obj)){
          $scope.hasMoreSurveys = false;
        }else{
          $scope.surveys = obj;
          $scope.limit = $scope.limit + 10;
        }
        $scope.$broadcast('scroll.infiniteScrollComplete');
      });
    }else{
      $scope.$broadcast('scroll.infiniteScrollComplete');
    }
  }

Thanks!!


#2

The problem is for spinner icon. Only works the first time.


#3

I found a way to do it, but it works sometimes :frowning:

Example:

$timeout(function(){
$scope.$broadcast('scroll.infiniteScrollComplete');
}, 5000);