我正在尝试使用Angular.js中的json输出的几个属性进行过滤,这是我的plunker链接。
实际问题是,如果我尝试按类型1进行过滤,那么它也会自动检查颜色过滤器值,我希望这两个过滤器应单独应用或组合使用。
我希望此过滤器应用于电子商务网站,以选择品牌,类别,最低和最高价格等。
该滤镜功能应该如何以角度编写。
答案 0 :(得分:1)
问题是您在两种不同类型的复选框中使用相同的checked
属性和ng-model
ng-checked="person.checked" ng-model="person.checked"
相反,你应该使用两个不同的模型,例如person.checked.type
和person.checked.color
,应该是这样的:
//in type checks
<input type="checkbox" ng-checked="person.checked.type" ng-model="person.checked.type"/> {{ person.type }}
//in color checks
<input type="checkbox" ng-checked="person.checked.color" ng-model="person.checked.color" {{ person.color }}
<强>更新强>
Here是一名工作人员