ExceptionLimeCat ExceptionLimeCat - 10 months ago 66
Javascript Question

ngRepeat Filter by deep property

If I have a complex object with objects as property values, how can I filter by one of the nested properties?

Can this be done with the OOB ng-repeat filter?


Name: 'John Smith',
Manager: {
id: 123,
Name: 'Bill Lumburg'


<li ng-repeat="e in emps | filter:Manager.Name">{{ e.Name }}</li>

Ray Ray

You need to pass in the argument to filter by:

<input ng-model="filter.key">
  <li ng-repeat="e in list | filter: {Manager: {Name: filter.key}}">
    {{e.Name}}  (Manager: {{e.Manager.Name}})

Example on Plunker