Please tell me, is it possible to specify the condition "or" in the angulyar in the standard filter? Something like this: tour in tours | filter : **{country: tourType}||{type: tourType}** : true" tour in tours | filter : **{country: tourType}||{type: tourType}** : true"

As "and" you can put 2 filters in a row ({country: tourType} | filter : {type: tourType}) , but is there any option for "or"?

It is clear that you can simply create your own filter, but I’m interested in the out-of-box solution, or not?

    1 answer 1

    Alas, there is no such functionality. Although it is not clear what the problem is to write a new filter. The growth of the application without increasing its code is not possible)

    If the filter is simple, you can create it with a normal function in the controller:

    Angular

     <li ng-repeat="item in products | filter:fruitOrVeg">{{item.name}}</li> 

    Js:

     function MyCtrl($scope) { $scope.products = [ {name:"Apple",type:"fruit"}, {name:"Grape",type:"fruit"}, {name:"Orage",type:"fruit"}, {name:"Carrot",type:"vegetable"}, {name:"Milk",type:"dairy"} ]; $scope.fruitOrVeg = function(product){ // Любые условия, и любое их количество return product.type == 'fruit' || product.type == 'vegetable'; // return (product.type == 'dairy' // || product.type == 'vegetable') // && product.name == 'Milk'; }; } 
    • Please try to write more detailed answers. I am sure the author of the question was grateful to you for the example filter. - Nicolas Chabanovsky
    • Thank. Actually, I immediately made my own filter, I just do not really want to sculpt bicycles instead of the existing functionality. But if this functionality is not, then fine. - Tolomuco