I have an object like this:

{
"batman":[{"applicantSkillID":"htl2","rating":3,"applicantInterviewerID":"usr1","applicantInterviewerName":"batman","applicantSkillName":"HTML"},
{"applicantSkillID":"cs43","rating":5,"applicantInterviewerID":"usr1","applicantInterviewerName":"batman","applicantSkillName":"css"}],

"Superman":[{"applicantSkillID":"ht12","rating":3,"applicantInterviewerID":"usr2","applicantInterviewerName":"Superman","applicantSkillName":"HTML"},
{"applicantSkillID":"cs43","rating":3,"applicantInterviewerID":"usr2","applicantInterviewerName":"Superman","applicantSkillName":"css"}]
}

Now I am trying to display data applicantInterviewerName wise (Batman's rating, Superman's rating etc..)

for only one applicantInterviewerName i can able to do it by taking the first object index like this:

<tbody class="table text-left boxShade displayTable">
    <tr ng-repeat="feedBack in c.data.interviewerFeedback">
        <td class="skillName" id="{{feedBack.applicantSkillID}}"> {{feedBack.applicantSkillName}}</td>
        <td>
            <div class="inputRangeDiv">
                <input class="inputRangeInputSlilder"
                   ng-init="skillScoreForm.skill[feedBack.applicantSkillID] = feedBack.rating"
                   ng-model="skillScoreForm.skill[feedBack.applicantSkillID]"
                   value="0"  
                   oninput="skillOutput.value = skillInput.value"
                   id='skillInput' type="range"
                   min="0" max="5"  ng-disabled="true" />

            </div>
        </td>
        <td>
            <div class="inlineFlex">
                <output id="skillOutput" class="output">{{feedBack.rating}}</output>
                <p class="applicantCutoffOutputSufixModalTable">/5</p>
            </div>
        </td>
    </tr>
</tbody>

How can i do it for all i think i am sure i need to use two ng-repeats one for applicantInterviewerName and one for skills but not getting idea to how to acheive it.?

  • yes you need two ng-repeat. and if you always have one object you dont need an ng-repeat – Sajeetharan yesterday
  • Would you mind creating a plunkr? i'll take it from there – Shashank Vivek yesterday
up vote 1 down vote accepted

Try this :

var obj = {
	"batman": [{
			"applicantSkillID": "htl2",
			"rating": 3,
			"applicantInterviewerID": "usr1",
			"applicantInterviewerName": "batman",
			"applicantSkillName": "HTML"
		},
		{
			"applicantSkillID": "cs43",
			"rating": 5,
			"applicantInterviewerID": "usr1",
			"applicantInterviewerName": "batman",
			"applicantSkillName": "css"
		}
	],

	"Superman": [{
			"applicantSkillID": "ht12",
			"rating": 3,
			"applicantInterviewerID": "usr2",
			"applicantInterviewerName": "Superman",
			"applicantSkillName": "HTML"
		},
		{
			"applicantSkillID": "cs43",
			"rating": 3,
			"applicantInterviewerID": "usr2",
			"applicantInterviewerName": "Superman",
			"applicantSkillName": "css"
		}
	]
};

function MyCtrl($scope) {
    $scope.items = obj;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app ng-controller="MyCtrl">
    <div ng-repeat="(key,value) in items">
      <div ng-repeat="data in items[key]">
        <span>Name : </span>{{data.applicantInterviewerName}} , <span>Rating : </span>{{data.rating}}
      </div>
    </div>
</div>

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.