我想通过单击按钮将ngFor的值传递给模型,但无法找到方法。我想将ngFor变量绑定到模型。我在SO中进行了搜索,但未找到解决方案。请提供帮助。
有可能做到吗?
enquiry.component.html
<div id="div1"></div>
<div id="div2"></div>
在打字稿文件中,我想捕获在ngFor中传递的数据
enquiry.component.ts
<div class="form-group">
<label for="sel1">Client Type:</label>
<select class="form-control" [(ngModel)]="model.clientType" >
<option>Business</option>
<option>Other</option>
</select>
</div>
<div class="form-group">
<label for="sel1">Number of Applicants:</label>
<select class="form-control" (change)="changeInApplicantCount(model.applicantCount)" [(ngModel)]="model.applicantCount" name="applicantCount">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
<div *ngFor="let applicant of fieldArray; let i = index">
{{arryApplcnt[i]}}
<div class="form-group">
<label for="usr">Applicant Title:</label>
<select class="form-control" [(ngModel)]="applicant.applicantTitle">
<option>Mr</option>
<option>Mrs</option>
<option>Dr</option>
</select>
</div>
<div class="form-group">
<label for="pwd">Applicant Surname:</label>
<input type="text" class="form-control" [(ngModel)]="applicant.applicantSurname">
</div>
<div class="form-group">
<label for="pwd">Employment Status:</label>
<select class="form-control" [(ngModel)]="applicant.employmentStatus">
<option>Employed</option>
<option>Self-Employed</option>
</select>
</div>
</div>
<button type="button" class="btn btn-primary float-right" (click)="enquiryStep1()">Next</button>
</div>