【发布时间】:2019-04-06 05:35:25
【问题描述】:
我正在使用角度材料 7。
我正在使用 单选按钮组。
我有一个我必须使用的桌子设计。所以这是固定的。
当我尝试在 td 中使用 单选按钮 时,我不确定是否愿意提供相同的组。
下面是我的html。
<tr>
<td>
<mat-radio-group >
<mat-radio-button value="maternal"></mat-radio-button>
</mat-radio-group>
</td>
<td>
<mat-radio-group >
<mat-radio-button value="paternal"></mat-radio-button>
</mat-radio-group>
</td>
</tr>
这是我的问题 https://stackblitz.com/edit/angular-tt2kep-woea34 的 stackblitz。
【问题讨论】:
-
如果您必须使用表格作为按钮,您可以尝试在 mat-radio-group 中围绕表格
-
行在循环中。所以每行我需要一个值。所以我不能在 mat-radio-group 中环绕桌子
-
或者,查看添加在 tr 周围的答案
-
这将完全破坏设计如果我在其他 td 中有其他控件怎么办
-
好吧,如果您不能将它们作为直接后代,我认为您无法使用提供的 API 来实现这一点。
标签: angular angular-material2 radiobuttonlist angular-material-7