2016-01-22 65 views
0

只是尝试执行从离子框架刷新,但它不起作用,图标只是继续显示,什么也没有发生。IONIC拉动刷新

任何人都可以指出问题出在哪里?

这是代码。

lists.html

<ion-header-bar align-title="center" class="bar-stable"> 
    <h1 class="title">Latest Items</h1> 
    <button class="button button-clear button-positive" ui-sref="addlist">New</button> 
</ion-header-bar> 
<ion-view title="Terbaru"> 
    <ion-content> 
     <ion-refresher on-refresh="doRefresh()"> 
     pulling-text="Pull to refresh..." 
     </ion-refresher> 
     <label class="item item-input"> 
     <i class="icon ion-search placeholder-icon"></i> 
     <input type="text" name="dash.search" value="" placeholder="Search"> 
     </label> 
     <div class="list card" ng-repeat="x in data" type="item-text-wrap" href="#/tab/chat/{{x.id}}"> 
      <div class="item item-avatar"> 
      <img data-ng-src="data:image/png;base64,{{x.photopath}}"> 
      <h2>{{x.title}}</h2> 
      <p>{{x.tgl}}</p> 
      </div> 

      <div class="item item-body"> 
      <img class="full-image" data-ng-src="data:image/jpeg;base64,{{x.imagepath}}"> 
      <p> 
       {{x.descr}} 
      </p> 
      <p> 
       <a href="#" class="subdued">1 Like</a> 
       <a href="#" class="subdued right">5 Comments</a> 
      </p> 
      </div> 
     </div> 
     </ion-content> 
</ion-view> 

controller.js

angular.module('ionicApp.controllers', []) 

.controller('AddListCategoryCtrl', function($scope, $http) { 
    var xhr = $http({ 
     method: 'post', 
     url: 'http://www.mywebsite.com/api/listCat.php' 
    }); 
    xhr.success(function(data){ 
    $scope.data = data.data; 
    }); 
    $scope.doRefresh = function(){ 
     $http.get('http://www.mywebsite.com/api/lists.php') 
     .success(function(data){ 
     $scope.data=data.data; 
     console.log($scope.data); 
     }) 
     .finally(function(){ 
     $scope.$broadcast('scroll.refreshComplete'); 
     $scope.$apply() 
     }); 
    } 
}); 
+0

你可以添加一个工作plunker? –

回答

1

。在你的代码中的错误。拉文字应该是ion-refresher的一个属性。

这是正确的代码:

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

你拉文本属性之前添加的结束标记。