Ionic refresher not working properly

2019-05-21 16:31发布

I am developing android app using Ionic framework. I used a <ion-refresher> tag to load the contents dynamically when the user pulls down the page. But it didn't work.

           <ion-refresher
                          pulling-text="Pull to refresh..."
                          on-refresh="doRefresh">
            </ion-refresher>

My controller code is blow:

$scope.doRefresh = function() {
              $http.get('http://localhost/test/gksfapp_backend.php?action=an').then(function(msg){
                     //never executed.
                     $scope.items=msg.data;
                     })
                     .finally(function() {
                     // Stop the ion-refresher from spinning
                         $scope.$broadcast('scroll.refreshComplete');
               });

How can I make this work?

1条回答
霸刀☆藐视天下
2楼-- · 2019-05-21 16:45

I believe you have simply forgotten the parenthesis after doRefresh

       <ion-refresher
                      pulling-text="Pull to refresh..."
                      on-refresh="doRefresh()">
        </ion-refresher>

Also, here is a working code example. http://codepen.io/ionic/pen/mqolp

查看更多
登录 后发表回答