,我有以下数据:AngularJS:通过内部数组对象场过滤
organizations:[{
name: "foo",
contacts: [{
firstName = "John",
lastName = "Doe",
email = "[email protected]"
},...]
},...]
然后,我有一个表,我列出所有的组织,我想知道是否有可能来过滤行表根据firstName过滤器或电子邮件过滤器。
例如,我有这样的代码:
<input type="text" id="name" ng-model="search.name">
<tr ng-repeat="organization in organizations | filter:search">
<td>{{organization.name}}</td>
<td>{{client.contacts[0].firstName}} {{ client.contacts[0].lastName }}</td>
<td>{{client.contacts[0].email}}</td>
</tr>
它只能由“姓名”字段的作品过滤。我试过这样的事情:
<input type="text" id="firstName" ng-model="search.contacts">
但它在联系人数组中的对象的所有字段中搜索,但我想具体搜索firstName。我能怎么做?
并ü尝试 –
我尝试了但不工作我认为,因为联系人是一个数组。 – fpavone