首页 > 解决方案 > 使用 Angular 供电的 Bootstrap 的单选按钮衣柜故障

问题描述

根据示例放置 Angular 驱动的 Bootstrap 单选按钮时,按钮看起来没问题。但是如果具有btn-group-toggle类的元素不是直接父元素,按钮会突然显示单选按钮乳头,如下图所示。如何在嵌套元素中布局非哺乳动物单选按钮?

单选按钮

html模板:

<table class="table">
  <tr class="btn-group btn-group-toggle" ngbRadioGroup>
    <th>Numbers</th>
    <th *ngFor="let month of [1,2,3,4]">
      <label ngbButtonLabel class="btn btn-primary">
        <input ngbButton type="radio" [value]="month" />{{month}}
      </label>
    </th>
  </tr>
</table>

<div class="btn-group btn-group-toggle" ngbRadioGroup>
  <label ngbButtonLabel class="btn btn-primary" *ngFor="let month of [1,2,3,4]">
    <input ngbButton type="radio" [value]="month" />{{month}}
  </label>
</div>

标签: angulartypescriptbootstrap-4

解决方案


推荐阅读