AngularJS filter for nested objects

I have an array of objects with arrays of objects in it:

var content = [
  { 
    name: 'Foo',
    sub: [{ name: 'Bar' }, { name: 'Foobar' }] 
  },
  ...
]

and a template:

<input ng-model="search" />

<div ng-repeat="item in content | filter:search>
   {{item.name}}
   <div ng-repeat="key in item">
      {{key.name}}
   </div>
</div>

Now, I use the filter filter to search for string matches, but it applies only to the first ng-repeat directive. How could I include the second directive into the search filter? Thanks in advance.

You can simply apply a second filter expression to your other ng-repeat

<div ng-repeat="key in item | filter:secondFilterExpression">

See docs here http://docs.angularjs.org/api/ng.filter:filter

Ok, I've 'flattened' the object to a simple collection before passing it through the controller to the template, so I don't have to worry about a second ng-repeat cycle. The output is

[{ name : 'foo' }, { name : 'bar' }, { name : 'foobar' }]