如何为mat-radio-button或mat-radio-group设置占位符?

问题描述 投票:0回答:1

我有一个DOM元素:

<mat-radio-group [formControlName]="field.name" [disabled]="field?.disabled">
  <div>
    <mat-label>{{ placeholder }}</mat-label>
  </div>
  <mat-radio-button *ngFor="let option of field.options" [value]="option.value">
    {{ option.label }}
  </mat-radio-button>
</mat-radio-group>

如何为mat-radio-buttonmat-radio-group设置本机占位符?

angular angular7 angular8
1个回答
0
投票

这可能会帮助:

<fieldset>
    <legend>
        <label [attr.for]="aaa">PlaceHolder</label>
    </legend>
    <div class="row">
        <mat-radio-group aria-label="Select an option">
            <mat-radio-button value="1">Option 1</mat-radio-button>
            <mat-radio-button value="2">Option 2</mat-radio-button>
        </mat-radio-group>
    </div>
</fieldset>

外观:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.