How to pass multiple parameter in angular filter function, not custom filter

Jay Shukla picture Jay Shukla · Dec 16, 2014 · Viewed 36k times · Source

I tried hard and visit lot of similar question like this but still unable to solve this issue.

I want to pass extra parameter in angular filter function. I found solution as below but it's not working. I am getting undefined for object which I have used in ng-repeat.

<li ng-repeat="user in users | filter:isStatus(user,secondParam)">{{user.name}}</li>

There are solution for angular custom filter as below but that also not working with angular filter function.

<li ng-repeat="user in users | filter:isStatus:user:secondParam">{{user.name}}</li>

jsFiddle - You can see my problem here.

Answer

user2700840 picture user2700840 · Dec 16, 2014

Will try:

$scope.isStatus = function(secondParam, thirdParam){
      return function(user) {
           console.log(secondParam);
           console.log(thirdParam);
           return user.status == $scope.status;
     }

Updated version http://jsfiddle.net/4PYZa/282/