我有一个动态 formArray,保存数据,一切工作正常,但我在修补值时遇到问题,而且我在网上找不到任何确切的解决方案。
下面是代码,
<form [formGroup]="educationAndExperienceForm">
<div formArrayName="educationForm">
<div *ngFor="let education of educationAndExperienceForm.controls.educationForm['controls'];let i = index;"
[formGroupName]="i">
<h6 class="text-left circularBold" *ngIf="i == 0"><b>Highest Qualification</b></h6>
<input type="text" class="education-inputs w-100 mt-3" placeholder="School/College/University"
formControlName="school"
[ngClass]="{ 'input-error': submitted && educationAndExperienceForm.controls.educationForm.controls[i].invalid }">
<input type="text" class="education-inputs w-100 mt-3" placeholder="Degree Ex: Master's"
formControlName="degree"
[ngClass]="{ 'input-error': submitted && educationAndExperienceForm.controls.educationForm.controls[i].invalid }">
<input type="text" class="education-inputs w-100 mt-3"
placeholder="Field of Education Ex: Computer Science" formControlName="specialization"
[ngClass]="{ 'input-error': submitted && educationAndExperienceForm.controls.educationForm.controls[i].invalid }">
<div class="text-left">
<input type="text" class="education-inputs w-100 mt-3" placeholder="Graduate Year"
formControlName="passed_year"
[ngClass]="{ 'input-error': submitted && educationAndExperienceForm.controls.educationForm.controls[i].invalid }">
</div>
对于我使用的第一种方式,我收到无法使用 forEach.. 错误
杨__羊羊
相关分类