title: How to apply a filter on multiple objects using AngularJS?
body: <p>I have the user object defined as below.</p>
  
  <pre><code>$scope.users = [{id: 1, name: 'Adam', friends: [{name: 'John', age: 21, sex: 'M'}, {name: 'Brad', age: 32, sex: 'M'}]}]
  </code></pre>
  
  <p>Then I have the following code:</p>
  
  <pre><code>&lt;div ng-repeat="user in users&gt;
   &lt;input type="text" ng-model="searchText"&gt;
   &lt;div ng-repeat="friend in user.friends | filter:searchText"&gt;
    {{user.name}} {{friend.name}} {{friend.age}}
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now when I type in the textbox the text: 'searchText', I want the filter to display the name of the user and the name/age of the friend. Can anyone help me with how to do this? </p>
  
  <p>If I am correct, then I think that I need to create a custom filter for this or is there any other way I can accomplish this?</p>