Ion-pull-to-refresh: Why list Did not refreshed?


#1

Hi,

I’ve ion-list with items into ion-content. I add ion-pull-to-refresh but when I pull the list is not refreshed.

<ion-content class="has-header back-content" padding="false">
    <ion-refresher
    pulling-text="Pull to refresh..."
    refreshing-text="Updating..."
    refreshing-icon="ion-refreshing"
    on-refresh="doRefresh()">
    </ion-refresher>
    
    <ion-list  
          show-delete="shouldShowDelete"
          can-swipe="listCanSwipe">
  <ion-item ng-repeat="item in items" class="item item-background">............

This is the refreshing funtion from the controller:

$scope.doRefresh = function () {

         console.log("Sono nel refresh");
          Service.GetItem($scope.uniqueID).success(function (response) { 
             console.log("Sono nel refresh - GetPublicFolderItems");
             $scope.items = response.Payload;
             $scope.listCanSwipe = true;
         }).
          error(function (response, status, headers, config) {
             console.log("Errore response doRefresh " + response);
         })
          .finally(function() {
       // Stop the ion-refresher from spinning
            console("Finally refreshing function");
            $scope.$broadcast('scroll.refreshComplete');
        });


};

Thanks


#2

if i look at the sample here http://learn.ionicframework.com/formulas/pull-to-refresh/ it seems like you are missing the $scope.$apply() statement?


#3

Uhm…I tried but I think that is not the problem. It not enter into the finally. I see “updating…” and don’t disappear.


#4

put your code in a codePen so other can reproduce your error, the code you have listsed above does not reflect the example


#5

Ok…I’ll try to extract code…