2016-08-15 37 views
0

我想在可以显示的数据超过过滤器后添加分页。我已经宣布一次可以显示6个数据的限制。我想通过在表格下添加分页来显示其余的数据。我该如何去做呢?在数据超出限制后添加分页

data.html

<section> 
    <div> 
    <table style="width:90%" class="table table-bordered" align="center" ng-controller="RetrieveDiaryController"> 
      <tr> 
        <th style="width:40%">Date</th> 
        <th style="width:30%">Type</th> 
        <th style="width:30%">Level</th> 
      </tr> 
     <tr ng-repeat="d in diaries | orderBy:'date':true | limitTo : limit"> 
     <td>{{d.date | date: "dd-MM-yyyy"}}</td> 
     <td>{{d.taken}}</td> 
     <td>{{d.level}}</td> 
     <tr ng-show="limit" ng-click='limit = undefined'> 
     </tr> 
    </table> 
    </div> 
    </section> 

health.js

.controller('RetrieveDiaryController', ['$scope', 'Diary', function ($scope, Diary) { 
     $scope.diaries = Diary.find(); 
     $scope.limit = 6; 
    }]) 
+0

使用一个数据表库来为你做。 – Mox

+0

有很多问题教导如何分页的项目..只是搜索它!我推荐这个[**模块**](https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination)。 – developer033

回答