朋友您好我的表格有问题,使用ngFor结构指令在tr中绘制td dinamically。
在下面的例子中,使用de ngFor no throw dblclick howerver生成的td点击它的作品!
<table>
<thead>
<tr>
<td *ngIf="deleteActive" class="delete-input">#</td>
<th *ngFor="let f of tableFields">{{f}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let r of tableData; index as i" (click)="rowClick(i,r)" (dblclick)="foo()" [ngClass]="{'selected': (i == selectedElementIndex)}">
<td *ngIf="deleteActive" class="delete-input"><input type="checkbox" (click)="selectedToDelete(i,r)"></td>
<td>{{r.name}}</td>
<td *ngFor="let authority of getAuthorities(r.authorities)">
ae
</td>
</tr>
</tbody>
</table>
当tds是静态的时,这个问题不会发生,只有在使用ngFor指令以动态方式生成td时才会出现。
谢谢,我希望能帮到我!