【问题标题】:angular 8 radio button not checked角度 8 单选按钮未选中
【发布时间】:2021-03-21 02:35:39
【问题描述】:

我有这个 html:

<div *ngFor="let option of systemEquipmentGroup">
              <h5>{{option.optionGroupName}}</h5>
              <div>
                <label style="display: block;" *ngFor="let opt of option.options; let i = index">
                  <input type="radio" (change)="onAct(opt)" style="position: inherit;" [name]="option.optionGroupName" [value]="opt.selected" />
                  {{opt.optionName}} {{opt.selected}}
                </label>
              </div>
          </div>

这是输出:

如您所见,控制台中的值是真/假。 如果值为 true,我需要检查单选按钮。

我做错了什么?

【问题讨论】:

    标签: angular radio-button angular8 angular-ngmodel


    【解决方案1】:

    您可以使用输入的checked 属性来实现此目的。我已经创建了一个示例,您可以查看here

    【讨论】:

      猜你喜欢
      • 2014-09-20
      • 2019-05-05
      • 2018-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-13
      • 2020-05-28
      • 2016-05-10
      相关资源
      最近更新 更多