如何在嵌套对象数组上应用过滤器

时间:2017-04-19 15:00:59

标签: html angularjs

大家好我是angularjs.我正在尝试对以下内容应用过滤器。但是发生的事情是不是使用ng-repeat后跟一些过滤器迭代所有列表值。它只是迭代jobseekerId只有1,2但不是3.就像我删除过滤器意味着它迭代所有列表值(1,2,3)。 我的代码有什么问题。请给出一些建议。

这是我的数据

 [ {
          "jobSeekerId" : 1,
          "firstName" : "vijay",
          "middleName" : null,
          "lastName" : "sury",
          "jobSeekerProfTitle" : "Having 2.2yerars of experience in the field java development with spring and hibernate",
          "profileUpdateDate" : "05 May 2014",
          "currentState" : "ap",
          "profilePath" : "E:/opt/jsimages/recru-profile.jpg",
          "currentCity" : "hyd",
          "salary" : "20000",
          "salaryType" : "per month",
          "jobSeekerSkillVo" : [ {
            "skill" : "js"
          }, {
            "skill" : "java"
          }, {
            "skill" : "uuu"
          } ],
          "academicInfoVo" : [ {
            "academicInfoId" : 1,
            "courseName" : "btech",
            "universityName" : "intuk",
            "academicEndYear" : 2014,
            "gpa" : 10.0
          } ],
          "city" : [ "hyd", "ts" ],
          "totalExperience" : "48",
          "viewCount" : "2",
          "downloadCount" : "0",
          "viewStatus" : "alive"
        }, {
          "jobSeekerId" : 2,
          "firstName" : "raj",
          "middleName" : null,
          "lastName" : "sury",
          "jobSeekerProfTitle" : null,
          "profileUpdateDate" : null,
          "currentState" : null,
          "profilePath" : null,
          "currentCity" : null,
          "salary" : null,
          "salaryType" : null,
          "jobSeekerSkillVo" : [ {
            "skill" : "uuu"
          }, {
            "skill" : "java"
          } ],
          "academicInfoVo" : [ {
            "academicInfoId" : 2,
            "courseName" : "btech",
            "universityName" : "intuk",
            "academicEndYear" : 2014,
            "gpa" : 8.0
          } ],
          "city" : [ ],
          "totalExperience" : "14",
          "viewCount" : "1",
          "downloadCount" : "0",
          "viewStatus" : "alive"
        }, {
          "jobSeekerId" : 3,
          "firstName" : "vj",
          "middleName" : null,
          "lastName" : "gg",
          "jobSeekerProfTitle" : null,
          "profileUpdateDate" : null,
          "currentState" : null,
          "profilePath" : null,
          "currentCity" : null,
          "salary" : "20000",
          "salaryType" : "per month",
          "jobSeekerSkillVo" : [ ],
          "academicInfoVo" : [ ],
          "city" : [ ],
          "totalExperience" : "0",
          "viewCount" : "1",
          "downloadCount" : "0",
          "viewStatus" : "alive"
        } ]

====================== 这是我的过滤器

<div class="wrapper" ng-app="candidateListApp" ng-controller="candidateListController">
<span ng-cloak  ng-repeat="jsList in jobSeekerList|filter:{jobSeekerSkillVo:
                                       {skill:drpSkill},})}}">                              
    <a ng-href="#">                                             
            {{jsList.firstName}}&nbsp;{{jsList.lastName}}
     </a>
</span>
<span ng-if="jsList.jobSeekerSkillVo.length != 0">
    <span ng-repeat="skills in jsList.jobSeekerSkillVo">
            {{skills.skill}}
            {{$last?'':','}}
    </span>
</span>
</div>
<script>
var app=angular.module("candidateListApp",[]);
    app.controller("candidateListController",function($scope,$http){
    $scope.jobSeekerList=${jobSeekerJsonArray};

    });
</script>

这是我的模型(使用jsp代码)

<select id="skills" name="skills" class="form-control2" ng-model="drpSkill">
    <option value="" disabled="disabled" selected="selected">Skills</option>
    <c:forEach items="${skillVo}" var="skills">
           <option value="${skills.skill}">${skills.skill}</option>
    </c:forEach>
</select>

0 个答案:

没有答案