【发布时间】:2019-05-13 13:50:37
【问题描述】:
基本上我正在更新我有用户信息的用户个人资料。这将绑定在用户各自的字段上。
this.editOfferprice= new FormGroup({
xyz : new FormControl(xxxx,[]),
xxx: new FormControl(xxxx,[Validators.required]),
wwwID : new FormControl(xxxx,[Validators.required]))};
在上面的代码中,我使用了 formgroup 和 formcontrol。
<mat-form-field fxFlex="49"> <mat-select placeholder="Select xxx" formControlName="xxx"> <mat-option *ngFor="let P of Pro" [value]="P.ID"> {{P.Name}} </mat-option> </mat-select> <mat-error *ngIf="editOffer.controls['xxx'].errors && editOfferprice.controls['xxx'].errors.required"> You must select NAme</mat-error> </mat-form-field>
我想知道如何在下拉列表中绑定数据?
【问题讨论】:
-
我认为这是您的解决方案 (stackoverflow.com/questions/38655613/…)
标签: angular typescript angular5 dropdown