How to filter multiple values (OR operation) in angularJS

前端 未结 20 1271
清酒与你
清酒与你 2020-11-22 10:01

I want to use the filter in angular and want to filter for multiple values, if it has either one of the values then it should be displayed.

I have for

20条回答
  •  情书的邮戳
    2020-11-22 10:33

    Too late to join the party but may be it can help someone:

    We can do it in two step, first filter by first property and then concatenate by second filter:

    $scope.filterd = $filter('filter')($scope.empList, { dept: "account" });
    $scope.filterd = $scope.filterd.concat($filter('filter')($scope.empList, { dept: "sales" }));  
    

    See the working fiddle with multiple property filter

提交回复
热议问题