ionic ion-list 滑到底部自动加载数据案例

  <ion-content>
    <ion-list>
      <ion-item ng-repeat="item in items track by $index">
        <p>{{item}}</p>
      </ion-item>
      <ion-infinite-scroll on-infinite="addItems()"></ion-infinite-scroll>
    </ion-list>
  </ion-content>

controller

     $scope.items = [];
        for (var i=0; i<100; i++) {
            $scope.items.push(i);
        }
        $scope.addItems = function() {
            var i = currentStart = 0;
            for (; i < currentStart+20; i++) {
                $scope.items.push("Item " + i);
            }

            currentStart += 20;
            $scope.$broadcast('scroll.infiniteScrollComplete');
        };

 

posted @ 2015-06-11 13:49  yshy  阅读(2466)  评论(1编辑  收藏  举报