0

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.?

2
  • yes you need two ng-repeat. and if you always have one object you dont need an ng-repeat Commented Jun 10, 2018 at 0:36
  • Would you mind creating a plunkr? i'll take it from there Commented Jun 10, 2018 at 5:21

1 Answer 1

1

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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.