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
您可以使用括号来嵌套表达式:
<div ng-repeat="(job in job | filter:location) | filter:salary">
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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.