首页 > 解决方案 > Angular 5 Material:以反应形式制作所需的 mat-radio-group

问题描述

试图使我的单选按钮组成为必需,但未能找到任何具体的方法。这是我的html代码和ts:

<mat-radio-group name="dealtype" [(ngModel)]="formType" formControlName="formType" required>
          <mat-radio-button value="New Lease">New Lease</mat-radio-button>
          <mat-radio-button value="Ground Lease-New">Ground Lease-New</mat-radio-button>
</mat-radio-group>


this.newLeaseForm = new FormGroup({
  'emailGroup': new FormControl({ value: this.selectedToAdd }),
  'emailList': new FormControl({ value: this.selectedToRemove }),
  'remarks': new FormControl({ value: this.remarks }),
  ['myControl']: new FormControl({ value: this.selectedBU.BusinessUnitId }, Validators.required),
  'formType': new FormControl(null, Validators.requiredTrue),

标签: angularangular-materialangular5

解决方案


推荐阅读