簡體   English   中英

如何使用angular-ui在桌子上使用分頁

[英]How to use pagination on table using angular-ui

這是我的代碼。 我試過了,但是它顯示了所有記錄,分頁似乎不起作用。

<div id="lead-casts" class="row" ng-show="showAllCast" width="auto" ng-init="getAllCast()">
<div class="col-sm-12">
    <h1 align="center">All Cast</h1>
    <table class="table table-striped">
        <th align="center"><h4>NAME</h4></th>
        <th align="center"><h4>ROLE</h4></th>
        <tbody>
        <tr ng-repeat="cast in allCast">
            <td>{{ cast.name }}</td>
            <td>{{ cast.role }}</td>
        </tr>
        </tbody>
    </table>
    <pagination total-items="totalItems" items-per-page="20" ng-model="currentPage"></pagination>
    <button class="btn btn-danger pull-left" ng-click="showCast()">Back</button>
    <button class="btn btn-info pull-right" ng-click="showCast()">Next</button>
</div>

我還嘗試在ng-repeat上使用limitTo過濾器,但它僅將顯示限制為20個項目。

<tr ng-repeat="cast in allCast | limitTo: 20">

如何將記錄或ng-repeat綁定到分頁?

使用startFrom和limitTo這是jsfiddle demo http://jsfiddle.net/2ZzZB/56/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM