I have the user object defined as below.
$scope.users = [{id: 1, name: 'Adam', friends: [{name: 'John', age: 21, sex: 'M'}, {name: 'Brad', age: 32, sex: 'M'}]}]
I have the following code:
<div ng-repeat="user in users>
<input type="text" ng-model="searchText">
<div ng-repeat="friend in user.friends | filter:searchText">
{{user.name}} {{friend.name}} {{friend.age}}
</div>
</div>
Now when i type in the textbox 'searchText', I want the filter to match for name of user or name/age of friend alone. Can anyone help me with how i can achieve this? If i am write i need to write a custom filter for this purpose or is there any other way i can get this?