简体   繁体   English

复选框过滤angularjs中的对象和数组

[英]checkboxes filtering object and array in angularjs

我希望过滤器功能像下面第一条评论中的小提琴一样工作,但是没有从ng-repeat中捕获复选框类别,我只想编写复选框的值并获取过滤后的单词,就像它们写在复选框的值中一样。 HTML。

You could do this just like normal checkboxes- only catch is that the value should be properly bound using ng-model to the required controller property. 您可以像普通复选框一样执行此操作,唯一的不足是使用ng-model将值正确绑定到所需的控制器属性。

     <input type="checkbox" ng-model="ctrl.filter.red" value="red"> Red <br>
     <input type="checkbox" ng-model="ctrl.filter.white" value="white"> White <br>
     <input type="checkbox" ng-model="ctrl.filter.champagne" value="champagne">Champagne 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM