Angular.js ng-repeat filter by property having one of multiple values (OR of values)

后端 未结 7 1529
一向
一向 2020-12-01 05:58

Is it possible to filter an array of objects, such that the value of property can be either of a few values (OR condition) without writing a custom filter

7条回答
  •  无人及你
    2020-12-01 06:31

    In HTML:

    In Angular:

    $scope.colorFilter = function (item) { 
      if (item.color === 'red' || item.color === 'blue') {
      return item;
     }
    };
    

提交回复
热议问题