这是我的代码,我不知道为什么,但是当我单击“提交”按钮时,我的formcontrolname没有发送值,并且我试图通过各种方式实现动态形式,因此这是一种方式。
FirstName和下拉列表中的点击值未收到,我的其他字段正在接收值
Dynamic-Forms.html
filterButton.leftAnchor.constraint(equalTo: menuButton.leftAnchor).isActive = true
filterButton.topAnchor.constraint(equalTo: menuButton.topAnchor).isActive = true
filterButton.rightAnchor.constraint(equalTo: menuButton.rightAnchor).isActive = true
filterButton.bottomAnchor.constraint(equalTo: menuButton.bottomAnchor).isActive = true
在usercheckedValue中,假设我有3个用户 这是我的控制配置数组
<form [formGroup]="u2">
<div *ngFor="let userCheckedValueDetails of userCheckedValue">
<div *ngFor="let controlConfigDetails of controlConfig">
<div class="form-group">
<div *ngIf="controlConfigDetails.name === 'FirstName'">
<span>{{userCheckedValueDetails.name}}</span>
<input type={{controlConfigDetails.type}} name= {{controlConfigDetails.name}} placeholder={{controlConfigDetails.placeholder}}
formControlName={{controlConfigDetails.formControlName}} value={{userCheckedValueDetails.name}} hidden>
</div>
<div *ngIf="controlConfigDetails.name === 'LastName' || controlConfigDetails.name === 'Email' || controlConfigDetails.name === 'Age' ||controlConfigDetails.name === 'Mobile'">
<input type={{controlConfigDetails.type}} name={{controlConfigDetails.name}} class="form-control" placeholder={{controlConfigDetails.placeholder}}
formControlName={{controlConfigDetails.formControlName}}>
</div>
<div class="dropdown" *ngIf="controlConfigDetails.name === 'State'">
<input type={{controlConfigDetails.type}} name={{controlConfigDetails.name}} class="form-control" placeholder={{controlConfigDetails.placeholder}}
formControlName={{controlConfigDetails.formControlName}} value={{StateDropDownValue}}>
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{{StateDropDownValue}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li *ngFor="let StateArray of StateName">
<a (click)="StateDropDownValue = StateArray ; ">{{StateArray}} </a>
</li>
</ul>
</div>
</div>
</div>
<button type="submit" (click)="onFormGroupSubmit(u2,userCheckedValueDetails)">Submit</button>
我知道我错过了一些小错误,但是没有得到哪件事只是帮了我忙