在不同的对象上使用AngularJS ng-repeat搜索过滤器

时间:2021-03-17 12:14:46

I have two array objects user and test. I am applying ng-repeat on the test and also put search filter it works for test object but not for the user object.

我有两个数组对象user和test。我在测试中应用了ng-repeat,并将搜索过滤器用于测试对象,而不是用于用户对象。

My code is

我的代码是

      <label>Search</label>
  <input ng-model="searchTest" type="text">
<div ng-repeat="t in list = (test | toArray | filter:searchTest | limitTo: maxLimit )"> 
    <td ng-bind="user[t.candidate].name"></td>
    <td ng-bind="user[t.candidate].place"></td>
   <td ng-bind="t.name"></td>

I'm unable to search the test using candidate name and place.

我不能使用候选名称和位置搜索测试。

1 个解决方案

#1


0  

Also, perhaps not related to the question directly, but it looks like your code has a inside a then 's - which is not good html. If you're going to do something like that, put the ng-repeat on a .

另外,可能与问题没有直接联系,但是看起来您的代码中有一个“then”,这不是很好的html。如果你要做这样的事情,把ng-repeat放到a上。

#1


0  

Also, perhaps not related to the question directly, but it looks like your code has a inside a then 's - which is not good html. If you're going to do something like that, put the ng-repeat on a .

另外,可能与问题没有直接联系,但是看起来您的代码中有一个“then”,这不是很好的html。如果你要做这样的事情,把ng-repeat放到a上。