2016-08-15 36 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

回答