0

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);

1 Answer 1

1

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;
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.