ionic ion-refresher 控件

<body ng-controller="MyCtrl">

  <ion-header-bar class="bar-positive">
    <h1 class="title">Refresher</h1>
  </ion-header-bar>

  <ion-content>

    <ion-refresher on-refresh="doRefresh()" pulling-text="Pull to refresh..." refreshing-text="Refreshing!" refreshing-icon="ion-loading-c">
    </ion-refresher>

    <ion-list>
      <ion-item ng-repeat="item in items">{{item}}</ion-item>
    </ion-list>

  </ion-content>

</body>
angular.module('ionicApp', ['ionic'])

.controller('MyCtrl', function($scope, $timeout) {
    $scope.myTitle = 'Template';
    
    $scope.items = ['Item 1', 'Item 2', 'Item 3'];
    
    
    $scope.doRefresh = function() {
        
        console.log('Refreshing!');
        $timeout( function() {

        $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
        $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
        $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
        $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);

        //Stop the ion-refresher from spinning
        $scope.$broadcast('scroll.refreshComplete');
        
        }, 1000);
        
    };
    
});
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容