我有2个表单,我只想通过单击一个提交按钮来提交它。这2个表单的值应该传递给服务。我该如何实现?预先感谢!
<form [formGroup]="ConvGroup">
<div class="row">
<div class="col-sm">
<b style="font-weight:bolder">Comment: </b>
<div class="form-group" *ngIf="IncidentModel.Status=='Response'">
<textarea formControlName="ResponseDescription" class="form-control" placeholder="Write Response comment"></textarea>
</div>
</div>
</div>
<button type="submit">Submit</button>
</form>
<form #formdata="ngForm" (ngSubmit)="updateData(formdata)">
<textarea class="form-control" name="problemDescription" readonly="readonly" [(ngModel)]="IncidentModel.ProblemDescription"></textarea>
<input type="text" class="form-control" name="status" [(ngModel)]="IncidentModel.Status" readonly="readonly" />
</form>
这是我的打字稿代码:
constructor(private raiseTicketService: RaiseTicketService) {
}
updateData(statusform: NgForm) {
this.raiseTicketService.postIncidentDetails(statusform.value).subscribe();
this.raiseTicketService.postIncidentConversation(this.ConvGroup.value).subscribe();
this.toastrService.warning('Updated Successfully');
}