如何启用以下情况下的单选按钮(在角度情况下)>

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

我正在使用下表...我想根据选中复选框(左侧)启用单选按钮(右侧)。取消选中该复选框时,我们要禁用btn广播。

         <table class="table">
              <thead>
                <tr>
                  <th>Select</th>
                  <th>
                    Group Name
                  </th>
                  <th>Profile</th>
                </tr>
              </thead>
              <tbody id="tabl">
                <tr *ngFor="let data of col; let i = index">
                  <td>
                    <input class="pull-left" type="checkbox" name="checkbox" value="{{data.id}}"
                      (change)="dataCheck($event,data)" />
                  </td>
                  <td> {{data.name}}</td>
                  <td>
                    <input type="radio" value="profile" name="profile" 
                       (click)="applyProfile(data.id,data.name)">
                  </td>
                </tr>

              </tbody>
            </table>

用于选中复选框,>

  dataCheck(event, data) {
      if (event.target.checked) {
         this.selectedGroups.push(data.id);
          console.log("selectedGroups push", this.selectedGroups);
      } else {
         this.selectedGroups = this.selectedGroups.filter(item => {
         item !== data.id;
      });

     }
   }

有人可以帮我吗?

我正在使用下表...我想根据选中复选框(左侧)启用单选按钮(右侧)。当我们取消选中该复选框时,我们要禁用无线电btn。

这里有一个示例,希望对您有所帮助,>]

https://stackblitz.com/edit/angular-ivy-cverak?file=src%2Fapp%2Fapp.component.html

u从这里得到的解释很少:https://stackoverflow.com/a/62277409/11465205

typescript angular6 angular7
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.