toggleCollapse(i) {
this.toggles[i] = !this.toggles[i];
return false;
}
我有一个父级'tr'标签,其中包含一个点击事件,可以切换折叠状态。里面有一个'td'标签,用于存放一些内容。我希望在单击'td'标签时取消点击事件的触发。示例代码:
<tr *ngFor="let record of records; let i = index" class="pointer" (click)="toggleCollapse(i)">
<td>{{record.id}}</td>
<td>{{record.skapad}}</td>
<td>{{record.status}}</td>
<td (click)="cancel here">
<pre *ngIf="!toggles[i]" class="wrap-whitespaces pointer-text">{{getShortContent(record.content)}}</pre>
<pre *ngIf="toggles[i]" class="wrap-whitespaces pointer-text">{{record.content}}</pre>
</td>
</tr>