NG-重复:单场过滤器 [英] ng-repeat :filter by single field
本文介绍了NG-重复:单场过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有说我重复过用NG-重复的产品阵列,并正在使用
I have an array of products that I'm repeating over using ng-repeat and am using
<div ng-repeat="product in products | filter:by_colour">
按颜色来过滤这些产品。该过滤器的工作,但如果产品名称/描述等包含颜色,然后应用筛选后,产品仍然存在。
to filter these products by colour. The filter is working but if the product name / description etc contains the colour then the product remains after the filter is applied.
我如何设置过滤器,只适用于我的数组的色域,而不是每一个领域?
How do I set the filter to only apply to the colour field of my array rather than every field?
推荐答案
请参阅在过滤器的例子页。使用一个对象,并设置颜色在颜色属性:
See the example on the filter page. Use an object, and set the color in the color property:
Search by color: <input type="text" ng-model="search.color">
<div ng-repeat="product in products | filter:search">
这篇关于NG-重复:单场过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文