ionic如何下拉获得更多数据(刷新)

来源:互联网 发布:纵横广联达软件 编辑:程序博客网 时间:2024/06/07 15:38

1.控制器获得更多数据

.controller('searchController', function($scope,$http){    $scope.works = [1,2,3];    $scope.doFresh = function () {      $http.get('2.php')        .success(function(newWorks){          $scope.works = newWorks;        })        .finally(function(){          $scope.$broadcast('scroll.refreshComplete');        });    };})

2.页面布局(得到数据并下拉刷新)

<ion-view view-title="登陆"><ion-content class="padding"><ion-refresher pulling-text="下拉刷新.." on-refresh="doFresh()"></ion-refresher><ion-list><ion-item ng-repeat="work in works">{{work}}</ion-item></ion-list></ion-content></ion-view>

3.app.js要注册页面(声明对应注册页面的控制器)
.state('search',{      url:"/search",      templateUrl:"templates/search.html",      controller:'searchController'    })

0 0
原创粉丝点击