【发布时间】:2014-02-10 12:42:49
【问题描述】:
您好,我有一个小项目,我想从多个动态添加的文本字段中执行搜索。
这是我添加搜索字段的方式:
<div class="form-group" ng-repeat="choice in choices">
<button ng-show="showAddChoice(choice)" ng-click="addNewChoice()">Add another choice</button>
<input type="text" ng-model="choice.name" name="" placeholder="Search criteria">
</div>
后来我有一个带有 ng-repeat 的表,这就是那部分:
<tr ng-repeat="todo in todos | filter: {filter from all fields}">
.......
</tr>
我想要做的是使用所有动态添加的搜索字段过滤内容。
【问题讨论】:
-
你能为此提交一个 jsFiddle。我还没有测试过,但是尝试 ng-repeat="todo in todos | filter: selection" 可能会起作用。
-
这是一个jsFiddle。并且没有过滤器:选择不起作用:/
标签: javascript angularjs angularjs-filter