gpt4 book ai didi

angularjs - 过滤后的目录分页获取行数-angularJs

转载 作者:行者123 更新时间:2023-12-04 03:19:44 27 4
gpt4 key购买 nike

我想在列表中显示过滤后的行数。使用 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>

谢谢

最佳答案

您必须手动执行此操作行数

改变

 <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

关于angularjs - 过滤后的目录分页获取行数-angularJs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39222946/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com