Just trying to figure out how to go about doing this. The basic idea of what I am trying to achieve is this
<div ng-repeat="product in products | filter: myFilter">
$scope.myFilter = function (item) {
return item === 'red' || item === 'blue';
};
However in my case, my filter parameters are stored in an array that will be changing dynamically based on user input. I have tried this but it won't work as I am returning in the loop.
var index;
$scope.filterParams = ['red', 'blue']
$scope.myFilter = function (item) {
for (index = 0; index < $scope.filterParams.length; ++index) {
return item === $scope.filterParams[index];
}
};
Help is appreciated, thanks!