Ionic refresher not working properly

匆匆过客 提交于 2019-12-22 12:31:16

问题


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:


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



来源:https://stackoverflow.com/questions/25909257/ionic-refresher-not-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!