Reputation: 8783
I'd like to use multiple filters on the same item for an ng-repeat. The idea is that for each job below I have different properties like location and salary and I'd like to be able to filter the results with both criteria.
So far, I've tried this:
<div ng-repeat="job in jobs | filter: location | filter: salary">
But it's obviously not working.
Does anyone have a clue how to fix this?
Thanks
Upvotes: 3
Views: 353
Reputation: 12864
You can create a custom filter.
<div ng-repeat="job in jobs | filter:customFilter">
And in your controller :
$scope.customFilter = function(item) {
if('Condition on your item')
return true;
return false;
}
Upvotes: 2
Reputation: 2167
You can use parenthesis to nest expressions:
<div ng-repeat="(job in job | filter:location) | filter:salary">
Upvotes: 2