角度JS中的动态多重复选框过滤器

时间:2017-03-17 18:25:41

标签: angularjs checkbox angular-filters

我正在使用此链接中的复选框过滤器。它工作正常,但如何更改它以选择多个复选框。现在只适用于1个复选框。

http://jsfiddle.net/HWa2m/243/

<input type="checkbox" data-ng-model="useBrands[brand]" />
                        {{brand}} <span>({{ (filteredProducts | filter:searchTerm | filter:count('Brand', brand)).length }})</span> </label>

1 个答案:

答案 0 :(得分:0)

更改

<div data-ng-repeat="brand in brandsGroup | limitTo: maxBrands" data-ng-if="(filteredProducts | filter:searchTerm | filter:count('Brand', brand)).length > 0">

<div data-ng-repeat="brand in brandsGroup | limitTo: maxBrands" >

{{brand}} <span>({{ (filteredProducts | filter:searchTerm | filter:count('Brand', brand)).length }})</span> 

{{brand}} <span>({{ (products | filter:searchTerm | filter:count('Brand', brand)).length }})</span>