首页 > 解决方案 > 打开角度模态弹出窗口时未选中角度材料单选按钮

问题描述

我们正在使用 angular material mat 单选按钮,它被选中。此单选按钮在使用另一组角度材料单选按钮打开角度模态弹出窗口时未选中。

<mat-radio-group class="example-radio-group" formControlName="selectedToRole" [name]="selectedRole"  >
                                <mat-radio-button *ngFor="let item of rolesForTransferToRadio"  [value]="item.role" (change)="displayBasedOnSelectedRole(item.role)">
                                    <span class="labelFontsValue col-md-3">{{item.roleCode}}&nbsp;</span>
                                </mat-radio-button>
                            </mat-radio-group>

```Typescript
this.modalReference = this.modalService.open(loadPlantLocationsContent);

标签: angularangular-material

解决方案


如果我正确理解您的问题,您正在寻找默认选择的单选按钮

您可以尝试将以下 CSS 类添加到单选按钮吗

mat-radio-checked

推荐阅读