【发布时间】:2016-05-02 11:52:19
【问题描述】:
我正在尝试在由ng-repeat 指令填充的表的多个列上添加过滤器。
<tr ng-repeat="descriptiveField in vm.descriptiveFieldList|filter:{name:vm.searchText}" ng-class-even="'even-bgcolor'">
<td ng-bind=descriptiveField.name></td>
<td ng-bind="descriptiveField.fieldDescription></td>
<td style="text-align: left" ng-bind=descriptiveField.source></td>
</tr>
我有搜索框
<input type="text" ng-model="vm.searchText" class="search-input"/>
过滤器仅应用于名称。我会搜索 2 列名称和来源。该怎么做?
【问题讨论】:
-
您可以为此使用自定义过滤器。看看docs.angularjs.org/tutorial/step_09
-
@RamDuttShukla 接受我的回答怎么样?
标签: javascript angularjs filter