I have the following data:
organizations:[{
name: "foo",
contacts: [{
firstName = "John",
lastName = "Doe",
email = "[email protected]"
},...]
},...]
Then I have a table where I list all the organizations and I want to know if it is possible to filter the rows in the table according to a firstName filter or a email filter.
For example I have this code:
<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>
It works filtering only by the 'name' field. I tried something like this:
<input type="text" id="firstName" ng-model="search.contacts">
But it searches in all fields of the objects in the contacts array, but I want to specifically search by firstName. How can I do?