【问题标题】:Add pagination after data exceeds limit数据超出限制后添加分页
【发布时间】:2016-12-21 06:27:21
【问题描述】:

我想在可以显示的数据超过过滤器后添加分页。我已经声明一次最多只能显示 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;
    }]) 

【问题讨论】:

  • 使用数据表库为你做到这一点。
  • 有很多问题教如何对项目进行分页..只需搜索它!我会推荐这个module

标签: html angularjs pagination strongloop apic


【解决方案1】:

您可以使用Angular ui bootstrap pagination directive

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-21
    • 2020-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多