如何区分调用过滤器angularjs

时间:2014-12-04 10:08:44

标签: angularjs

<li>
     <p>By Member Status</p>
        <p><label><input type="checkbox" ng-model="filter['top']"> top</label></p>
        <p><label><input type="checkbox" ng-model="filter['low']"> low</label></p>
                </li>
<li>
                    <p>By ADMIN Status</p>
                    <select class="form-control" ng-init="selectedSearch = 'default'">
                        <option value="default">Select Status</option>
                        <option value="A" ng-model="filter['a']">A</option>
                         <option value="B" ng-model="filter['b']">B</option>
                    </select>
                </li>

    <div class="complete-profile" ng-class="{active:show}" ng-repeat="mylist in mylist | filter:filterByCategory"></div>

  $scope.filterByCategory = function (stat) {
       return $scope.filter[stat.state] || noFilter($scope.filter); // checkbox
    };
$scope.filterByCategory = function (stat) {
       return $scope.filter[stat.drop] || noFilter($scope.filter); // dropdown
    };

我需要在mylist上应用这两个过滤器,但不知何故,一个过滤器用于复选框或下拉列表都不起作用。

1 个答案:

答案 0 :(得分:0)

您应该更新过滤逻辑。 Code here

...
$scope.filter = {
    top: false,
    low: false,
    byAdminStatus: 'A'
}
...