Dir-paginate GET行计数过滤器后 - angularJs

时间:2016-08-30 08:56:32

标签: angularjs filter dirpagination

我希望在列表中有过滤后的行数。 使用dir-paginate,结果总是5(== itemsPerPage)或者我有> 5行。 有谁知道如何在我的dir-paginate中获取所有页面的行数?



<div>count filtered :  ({{ filtered.length }})</div>
<input type="text" class=" text-input form-control" ng-model="search.name"  placeholder="name">
<div class="col-md-6">
        <table class="table">
            <thead>
                <tr>
                    <th></th>
                    <th>Title</th>
                </tr>
            </thead>
            <tbody>
                <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">
                    <td>{{ person.name }}</td>
                </tr>
            </tbody>
        </table>
</div>
<dir-pagination-controls max-size="5"
         direction-links="true"
         boundary-links="true" class="pagination">
</dir-pagination-controls>
&#13;
&#13;
&#13;

感谢

1 个答案:

答案 0 :(得分:2)

您必须手动执行此行计数

更改

 <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">

<tr dir-paginate="person in filtered = (persons | filter:_this.search)  | itemsPerPage:5 " pagination-id="excluded">

您可以按filtered.length

计算

Ref