Javascript 如何循环遍历angularjs中的对象数组
我有一个这样的物体:Javascript 如何循环遍历angularjs中的对象数组,javascript,arrays,angularjs,json,angularjs-ng-repeat,Javascript,Arrays,Angularjs,Json,Angularjs Ng Repeat,我有一个这样的物体: { "batman":[{"applicantSkillID":"htl2","rating":3,"applicantInterviewerID":"usr1","applicantInterviewerName":"batman","applicantSkillName":"HTML"}, {"applicantSkillID":"cs43","rating":5,"applicantInterviewerID":"usr1","applicantInterviewer
{
"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"}]
}
<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>
现在我正在尝试显示数据applicationinterviewername
wise(蝙蝠侠评级、超人评级等)
对于一个applicationterviewername
我可以通过如下方式获取第一个对象索引:
{
"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"}]
}
<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>
{{feedBack.applicationskillname}
{{反馈.评级}
/5
我想我肯定我需要使用两个
ng重复,一个用于applicationterviewername
,一个用于技能,但不知道如何实现它。试试这个:
var obj={
“蝙蝠侠”:[{
“Appliantskillid”:“htl2”,
“评级”:3,
“应用程序视图ID”:“usr1”,
“应用程序视图名称”:“蝙蝠侠”,
“应用程序技能名称”:“HTML”
},
{
“Appliantskillid”:“cs43”,
“评级”:5,
“应用程序视图ID”:“usr1”,
“应用程序视图名称”:“蝙蝠侠”,
“应用程序技能名称”:“css”
}
],
“超人”:[{
“Appliantskillid”:“ht12”,
“评级”:3,
“应用程序视图ID”:“usr2”,
“应用程序视图名称”:“超人”,
“应用程序技能名称”:“HTML”
},
{
“Appliantskillid”:“cs43”,
“评级”:3,
“应用程序视图ID”:“usr2”,
“应用程序视图名称”:“超人”,
“应用程序技能名称”:“css”
}
]
};
函数MyCtrl($scope){
$scope.items=obj;
}
名称:{data.applicationInterviewerName},评级:{{data.Rating}
是,您需要两个ng重复。如果你总是有一个对象,你不需要重复,你介意创建一个plunkr吗?我从那里拿