这里有一个示例,希望对您有所帮助,>]
https://stackblitz.com/edit/angular-ivy-cverak?file=src%2Fapp%2Fapp.component.html
我正在使用下表...我想根据选中复选框(左侧)启用单选按钮(右侧)。取消选中该复选框时,我们要禁用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。