ExceptionLimeCat ExceptionLimeCat - 1 year ago 98
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
Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download