Reputation: 9212
I have given code in my function.
$scope.FilteredList = $filter('filter')(ProductService.Products, $scope.FilterExpr, false);
where $scope.FilterExpr
is bind with text field.
Above filter works as expected for me, and when user types something in text field, $scope.FilteredList
gets populated with filtered items.
ProductService.Products
is an array of objects with following fields in object. name
, mrp
, sp
, incart
.
I want to create another filter which filters all the items where incart
value is > 0.
what should i use instead of ?????
in below line.
$scope.FilteredList = $filter('filter')(ProductService.Products, ?????, false);
Upvotes: 0
Views: 30
Reputation: 136194
You don't need to use $filter
again. Do use .filter
over $scope.FilteredList
collection to get desired result.
var result = $scope.FilteredList.filter(function(item){
return item.incart > 0;
});
Upvotes: 1