I have a filter that should only return items from an object if their elements exist in a specified array:
$scope.isCategory = function() {
return function(item) {
if($scope.filterObj.categories.length > 0) {
return angular.forEach( $scope.filterObj.categories, function(value, key) {
return (item.categories.indexOf(value) == -1);
});
}
return item;
}
};
For example, where $scope.filterObj
contains ["a", "b"] and item.categories
contains ["a"].