我尝试使用此代码显示有多少个选中的复选框
<li class="list-group-item" ng-repeat="user in data">
<input type="checkbox" ng-model="user.checked"/>
{{user.name}}
</li>
<p>total checked: {{user.checked.length}}</p>
我也在 {{}} 中尝试了 count() 但不起作用。
最佳答案
您应该通过checked
属性过滤用户:
<p>total checked: {{ (data | filter:{checked: true }).length }}</p>
关于javascript - 计算angularjs中选中复选框的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24451164/