0

我想在可以显示的数据超过过滤器后添加分页。我已经声明一次最多只能显示 6 个数据。我想通过在表格下添加分页来显示其余数据。我该怎么做呢?

数据.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>

健康.js

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

1 回答 1

0

您可以使用Angular ui 引导分页指令

然后根据每页的结果数在分页上添加 ng-show/ng-hide。

于 2016-08-15T08:53:32.007 回答