如何将一个div元素的id传递给另一个在循环中执行的第二个元素?

时间:2019-05-28 06:23:12

标签: html angular

我有两个div元素,我的要求是如何在第二个div元素中传递present的id并在循环中执行到第一个div元素按钮。这是示例代码:

<div style="float: right;">
     <button type="button" (click)="delete(skillGroupAndTypeRow.id);"></button>
</div>  
<table class="table table-bordered">
  <thead>
    <tr>
      <th>Select</th>
      <th>Skill Group Names</th>
      <th>Skill Type</th>
    </tr>
  </thead>
  <tbody>
    <tr #skillGroupAndTypeRow *ngFor="let group of groups; let i=index;" id="skillRow-{{i}}">
      <td>
        <input type="checkbox" id="group-{{i}}"  >
        </td>
        <td>{{group.name}}</td>
        <td>{{group.type}}</td>
      </tr>
    </tbody>
</table>

那么如何将代码的ID传递到上面div中存在的删除按钮中。

使用这种方法时,会出现一个错误,提示无法读取未定义的ID。

0 个答案:

没有答案