AngularJS filter with nested properties
by ExpertSystem
HTML
<script src="http://code.angularjs.org/snapshot/angular.min.js"></script>
<div ng-init="friends = [{details:{name:'John'}, phone:'555-1276'},
{details:{name:'Mary'}, phone:'800-BIG-MARY'},
{details:{name:'Mike'}, phone:'555-4321'},
{details:{name:'Adam'}, phone:'555-5678'},
{details:{name:'Julie'}, phone:'555-8765'},
{details:{name:'Juliette'}, phone:'555-5678'}]"></div>Search:
<input type="text" ng-model="searchText" />
<table id="searchTextResults">
<tr>
<th>Name</th>
<th>Phone</th>
</tr>
<tr ng-repeat="friend in friends | filter:{details:{name:searchText||''}}">
<td>{{friend.details.name}}</td>
<td>{{friend.phone}}</td>
</tr>
</table>