JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app ng-controller="Main">
<input type="text" ng-model="status">
<input type="text" ng-model="name">
<h2>Custom filter</h2>
<ul>
<li ng-repeat="user in users | filter:isStatus(status, name)">{{user.name}}</li>
</ul>
<h2>expression</h2>
<ul>
<li ng-repeat="user in users | filter:{status: status, name: name}">{{user.name}}</li>
</ul>
</div>
CSS
h2 {
font-size: 16pt;
margin-top: 10px;
}
JavaScript
function Main($scope){
$scope.status = 1;
$scope.name = "first";
$scope.users = [{name: 'first user', status: 1},
{name: 'second user', status: 2},
{name: 'third user', status: 3}];
$scope.isStatus = function (status, name) {
return function (user) {
return user.status === parseInt(status) &&
(!name || (user.name.indexOf(name) > -1));
}
};
}