http://www.cnblogs.com/xuan-0107/p/4428844.htmlhtml
下拉刷新promise
<ion-content> <ion-refresher pulling-text="Pull to refresh..." on-refresh="doRefresh()"> </ion-refresher> <ul class="list"> <li class="item" ng-repeat="item in items">{{item}}</li> </ul> </ion-content>
下拉刷新完畢也要廣播
spa
// 下拉刷新方法 $scope.doRefresh = function () { var promise = TodoListFty.getTodoLists(); promise.then( function (result) { console.log(result); $scope.todoListData = result; }, function (reason) { console.log("獲取待辦任務失敗" + reason); } ).finally(function () { // 刷新完畢要廣播刷新完畢事件 $scope.$broadcast('scroll.refreshComplete'); }); };
滾動刷新code
<ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>
地方滾動刷新完成的時候也要廣播htm
.controller('MyCtrl', function($scope) { $scope.noMoreItemsAvailable = false; $scope.loadMore = function() { $scope.items.push({ id: $scope.items.length}); if ( $scope.items.length == 99 ) { $scope.noMoreItemsAvailable = true; } $scope.$broadcast('scroll.infiniteScrollComplete'); }; $scope.items = []; });