角度多重ng重复多重滤波器

时间:2017-03-28 08:59:49

标签: javascript jquery html angularjs

我有一个包含多个过滤器的多重ng重复列表。

我使用(例如:A.value)if(例如:B.value),但我想使用多个过滤器。

我想要多个过滤器recommended_search和skill_search以及language_search,

然后搜索结果想要改变整个(html div class =“panel”)

现在recommended_search过滤器没问题,但skill_search和language_search过滤器只是跨度范围(html span id =“language”和span id =“skill”)

如何进行多个过滤器搜索结果以更改整体(html div class =“panel”)?

angular.js

$scope.recommend=[];
  $http.get('/recommend/ajax').success(function (data, status) {
     $scope.recommend = data;
  });

HTML

<div ng-controller="recommendCtrl">
<!-- search -->
<div class="col-lg-12" style="margin-bottom:20px;">
    <div class="input-group">
        <span class="input-group-btn">
          <input type="text" class="form-control" placeholder="recommend search" ng-model="recommend_search.name">
        </span>
        <span class="input-group-btn">
          <input type="text" class="form-control" placeholder="skill search" ng-model="skill_search.skill_name">
        </span>
        <span class="input-group-btn">
          <input type="text" class="form-control"  placeholder="language search" ng-model="language_search.languagelv_name">
        </span>
    </div>
</div>

<!-- recommend -->
<div class="panel panel-default" ng-repeat="(key, value) in recommend.recommend  | orderBy:'-id' | filter:recommend_search">
    <div class="panel-body">
        <!-- content -->
        <div class="panel-content">
                <label class="ahr-label_bs">
                    @{{ value.family_name}}@{{value.surname}}
                    <span ng-if="value.sex == 1">♂</span>
                    <span ng-if="value.sex == 0">♀</span>
                </label>
                <span>@{{value.name}}</span>
                <!-- skill -->
                <label class="label-gray">skill</label>
                <span id="skill" ng-repeat="skill in recommend.personnels_skill  | filter:skill_search" ng-if="value.personnels_id == skill.personnels_id">
                              @{{skill.skill_name}}、
                            </span></p>
                <!-- language -->
                <label class="label-gray">language</label>
                <span id="language" ng-repeat="language in recommend.languagelvs  | filter:language_search" ng-if="value.personnels_id == language.personnels_id">
                              @{{language.languagelv_name}}、
                </span>

                <label class="label-gray">country</label><span>@{{ value.country }}</span></p>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

您可以链接过滤器。

<div class="panel panel-default" ng-repeat="(key, value) in recommend.recommend  | orderBy:'-id' | filter:recommendSearch | filter:anotherFilter | filter: oneMoreFilter">