I am trying to use a ng-repeat filter, however i can't seem to get it working.
html:
<li dnd-draggable="item" ng-repeat="item in items| filter: integrateFilter">
</li>
Filter:
$scope.integrateFilter = function (item) {
return !$scope.integratesInput ?
item : (item.type == $scope.itemTypes[0].type);
};
The structure of the data:
$scope.itemTypes is an array of types that i want to filter with:
products: Array[2]
0: Object
type: "food"
1: Object
type: "beverage"
The "items" in the list is an array of objects like:
0: Object
name: "steak"
type: "food"
So basically i want to filter items with an Array ($scope.itemTypes). The filter i'm using right now only returns one result (0) the beginning of the array. is there a way to use a filter like this? or will i need to loop through the $scope.itemTypes?
Thanks