modelData:
0:Object
1:Object
CandidateName:"Smith John"
ControlId:0
CreatedBy:null
CreationDateTime:null
ExamId1:289
ExamName:"Drawings"
Id:1284073
功能
public loadTestCenterData() {
if (this.modalData!=null) {
for (let v of this.modalData) {
console.log(v.ExamName);
this.groups = [{
heading: v.ExamName,
content: [{
CandidateName: v.CandidateName,
Id: v.Id,
time: '12:00',
Percentage: '13%',
Present: '50%'
}]
}];
this.groups.push(v);
}
}
console.log(this.groups);
}
从上面的代码我循环遍历modelData并动态创建一个包含标题和内容json的组数组,这里我不是在组中进行geeting循环,控制台只显示第一个对象,请帮助我。