angular - 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),
解决方案
推荐阅读
- python - 熊猫DF。对于每一行,返回 True 值的列名
- ios - React Native XCode:我应该创建一个新的包标识符吗?
- python - 将 PySpark 数据帧列表写入 S3 存储桶
- javascript - TinyMCE 出现“SBOX_FATAL_MEMORY_EXCEEDED”
- arrays - 如何为C中的字符串数组赋值?
- node.js - Npm Start 不运行 node.js,不运行脚本
- java - 使用递归将 NaturalNumbers 除以二
- apache-kafka-connect - How do I upgrade my Debezium plug-in version in Kafka connect?
- python - 将 h5 模型转换为 tensorRT 的 uff 模型时出错
- java - 安装 AdoptOpenJDK 11 并删除旧的 java 8?