找到下面的数组和对象以及我需要调用的数组的数据, 将名称sectionId = name; shiftId = name转换为具有id:_id的html角材料以传递到component.ts,
***************数据****************
"mainData": [{
"gradeId": {
"organId": "5a90152",
"name": "primary",
},
"clSectionId": [{
"sectionId": {
"_id": "533d06",
"organId": "5a90152",
"name": "AA",
},
"shiftId": [{
"_id": "b1fbfe",
"name": "MORNING",
"organId": "5a90152"
"days": [
"Monday"
]
},
{
"_id": "03de8a",
"name": "EVENING",
"organId": "5a90152",
"days": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
]
}
]
}
}
]
************ html ***********
<mat-form-field>
<mat-select
placeholder="Grade"
[(ngModel)]="selectedValue"
(change)="changefunction($event)"
name="grade">
<mat-option
*ngFor="let class of classes"
[value]="class.gradeId._id">
{{class.gradeId.name}}
</mat-option>
</mat-select>
</mat-form-field>