I have an array of employees that look like
$scope.Arr = [
{'name':'John','title':'CEO','Age':'32'},
{'name':'Jill', 'title':'Sales Executive', 'Age':'44'},
{'name':'Alex','title':'Developer','Age':24}
];
I use ng-repeat to render this array in html and am looking to make the filter work such that the same input control's value can be used to filter employees based on both the name as well as title.
<input type='text' data-ng-model='search.name' />
<div>
<span data-ng-repeat="emp in Arr | filter:search">
<p> {{emp.name}} </p>
<p> {{emp.title}} </p>
</span>
</div>
The above code only lets me filter on basis of employee name
filter:search.name. Note that it will compare the model value to all properties, not just name and titlenameandtitlewith thesearchmodel.searchinstead ofsearch.nameworks just fine