【发布时间】:2015-07-16 16:09:29
【问题描述】:
我在 Angularjs 中有一个 html 页面。在页面中有两个 div,一个包含有关用户总数的数据,另一个 div 包含从服务中填充数据的表,即用户列表。
代码是。
app_user.html
// IN this div i am getting the total no of users by users.length
<div id ="total_user"> no of users {{users.length}} </div>
<div id ="user_table">
// In this the no of users keeps changing as soon filter is applied
<tr ng-repeat="row in users | filter : {status: search['_status']} | filter : {payment_type:search['pay_type']}| orderBy : orderBy:reverse ">
<td >
<div ng-if="row.status !== 'Failure'"><!--{{$index}} -->
<input type="checkbox" checklist-model="user.roles" checklist-value="row.id">
</div>
</td>
<td>
<a ng-href="https://userapp.com/{{row.id}}" target="_blank">{{row.username}}</a>
</td>
<td>
<div>
<div>{{row.location}}</div>
</div>
</td>
</div>
在第一个 div 中,我找到了用户总数,在第二个 div 中,我显示了包含详细信息的用户列表。
我已经应用了运行良好的过滤器。现在我想要的是当我应用过滤器时,用户的数量也应该针对应用的特定过滤器进行更改。我不知道如何将row.length 传递给外部 div。
例如:在应用过滤器之前,我的用户总数为 100,当我应用过滤器时,用户总数现在为 40。现在在第一个 div 中,我想将用户总数显示为 40 而不是100.
【问题讨论】:
-
问题不清楚..请详细说明
-
@PankajParkar ..我已经对我的问题进行了编辑..我希望它会有所帮助
-
@Mahesh Sapkal 添加的答案是您想要的准确答案