【发布时间】:2020-11-17 18:38:33
【问题描述】:
我正在尝试创建一个包含单选按钮的动态表单。
<div *ngFor="let opt of question.options">
<input [formControlName]="question.key" [value]="opt.key" [type]="question.controlType" [id]="opt.key" [name]="question.key"/>
<label [htmlFor]="opt.key">{{opt.value}}</label>
</div>
但是加载页面时,HTML 中的 value 属性为空。可能的原因是什么?
<input _ngcontent-mjy-c129="" ng-reflect-name="gender" type="radio" value="" id="male" name="gender" class="ng-invalid ng-dirty ng-touched">
【问题讨论】:
-
在此处更新问题 JSON 值
标签: html angular radio-button