尝试从离子框架中实现pull to refresh,但它不起作用,图标只是一直显示,没有任何反应。
任何人都可以指出问题在哪里?
这是代码。
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 :(得分:1)
您的代码中存在错误。提取文本应该是ion-refresher
的属性。
这是正确的代码:
<ion-refresher on-refresh="doRefresh()" pulling-text="Pull to refresh...">
</ion-refresher>
您在pull-text属性之前添加了结束标记。