Javascript 基于or运算符逻辑的angularjs过滤器

Javascript 基于or运算符逻辑的angularjs过滤器,javascript,angularjs,Javascript,Angularjs,我有一个看法: <tr> <td> <label class="radio-inline"> <input type="radio" name="Active" checked ng-click="sort('false','false','false')">Active <span class="label label-success">{{tota

我有一个看法:

 <tr>
     <td>
         <label class="radio-inline">
              <input type="radio" name="Active" checked ng-click="sort('false','false','false')">Active
              <span class="label label-success">{{totalActive}}</span>
         </label>
     </td>

     <td>
         <label class="radio-inline">
             <input type="radio" name="Active" ng-click="sort('true','','true')">Archieve
             <span class="label label-warning">{{appliedJob.length-totalActive-totalClosed}}</span>
         </label>
     </td>
     <td>
         <label class="radio-inline">
             <input type="radio" name="Active" ng-click="sort('','true','')">Closed
             <span class="label label-warning">{{totalClosed}}</span>
         </label>
     </td>
 </tr>

 <tr data-dir-paginate="item in appliedJob|orderBy:'AppliedDate':true|filter:{HiredAnother:filterText, Closed:Closed,Withdraw:w}|itemsPerPage:5">
我想要的是,如果retrach为false,它将继续执行
Archieve
(无论
hiredather
是否为true/false)。但在过滤器中,它只会打开
Archieve
列表
hiredother=true
draw=true
。 如何在ng repeat filter中生成or(| |)运算符

清除我的需要:

Active-->HiredAnother=false,Closed=false, Withdraw=false
Archieve-->HiredAnother=true/false,Closed=false, Withdraw=false/true(HiredAnother and Withdraw- must be false at least one)
Closed-->HiredAnother=true/false,Closed=true, Withdraw=false/true
============================已升级到预期结果==========================

 <tr>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="Active" checked ng-click="sort('ac')">Active
                        <span class="label label-success">{{totalActive}}</span>
                    </label>
                </td>

                <td>
                    <label class="radio-inline">
                        <input type="radio" name="Active" ng-click="sort('ar')">Archieve


                        <span class="label label-warning">{{appliedJob.length-totalActive-totalClosed}}</span>
                    </label>
                </td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="Active" ng-click="sort('cl')">Closed
                        <span class="label label-warning">{{totalClosed}}</span>
                    </label>
                </td>
            </tr>

<tr data-dir-paginate="item in appliedJob|orderBy:'AppliedDate':true|filter:myFilter|itemsPerPage:5">


 //Filter based on radio button
$scope.myFilter = function (i) {
    return i.HiredAnother == false && i.Withdraw == false && i.Closed == false; //Active
};

$scope.sort = function (term) {

    if (term == 'ac') {
        $scope.myFilter = function (i) {
            return i.HiredAnother == false && i.Withdraw == false && i.Closed == false; //Active
        };
    }

    else if (term == 'ar') {
        $scope.myFilter = function (i) {
            return i.HiredAnother == true || i.Withdraw == true && i.Closed == false; //Arcieve
        };
    }
    else if (term == 'cl') {
        $scope.myFilter = function (i) {
            return i.Closed == true; //Arcieve
        };
    }
}
//Filter based on radio button END

活跃的
{{totalActive}}
拱门
{{appliedJob.length totalActive totalClosed}
关闭
{{totalClosed}}
//基于单选按钮的过滤器
$scope.myFilter=函数(i){
return i.hiredother==false&&i.draw==false&&i.Closed==false;//活动
};
$scope.sort=函数(术语){
如果(术语=='ac'){
$scope.myFilter=函数(i){
return i.hiredother==false&&i.draw==false&&i.Closed==false;//活动
};
}
else如果(术语=='ar'){
$scope.myFilter=函数(i){
返回i.hiredother==true | | i.draw==true&&i.Closed==false;//Arcieve
};
}
else如果(术语=='cl'){
$scope.myFilter=函数(i){
返回i.Closed==true;//Arcieve
};
}
}
//基于单选按钮端的滤波器

我建议使用为每个appliedJob调用的自定义筛选函数

<tr data-dir-paginate="item in appliedJob | filter: myCoolFilter">

我建议使用为每个appliedJob调用的自定义过滤器函数

<tr data-dir-paginate="item in appliedJob | filter: myCoolFilter">

你在用这个吗?是的。为什么?这和我的需要有什么关系吗?请提供帮助信息,以及那些试图知道API确切位置的人possible@basarat你能帮我吗?你在用这个吗?是的。为什么?这和我的需要有什么关系吗?请提供帮助信息,以及那些试图知道API确切位置的人possible@basarat您能帮助我吗?但如何使用单选按钮中的“单击事件”来执行此操作?当
$scope.filterText
$scope.Closed
等更改时,由于摘要循环,列表会自动更新。我假设您已经知道angularjs是如何工作的。但是我如何使用单选按钮中的click event(单击事件)来做到这一点呢?当
$scope.filterText
$scope.Closed
等更改时,由于摘要循环,列表会自动更新。我想你已经知道angularjs的工作原理了。
$scope.myCoolFilter(value, index, array) {
    // change here according to your logic
    return $scope.filterText || $scope.Closed; 
}