这是我的html
<div class="playground-component" (click)="handleBoardClick()" >
<div class="actions">
<div (click)="clear()">Clear</div>
<div (click)="serialize()">Serialize</div>
<div (click)="saveTask()">Save</div>
</div>
<div class="component" *ngFor="let node of nodes; index as i">
<div class="header">
<div class="title">{{node.name}}</div>
<div class="icons">
<div class="action settings" (click)="detachConnectionsForElement(node)">
<i class="fa fa-unlink"></i>
</div>
<div class="action settings" (click)="togglePropertiesPopup(node,i)">
<i class="fa fa-cog"></i>
</div>
<div class="action del" (click)="deleteComponent(node)">
<i class="fa fa-trash"></i>
</div>
</div>
</div>
</div>
</div>
在上面的html主div中包含两个div标签,内部div根据我的数组重复。当用户右键单击重复的(* ngFor)div标签显示复制和粘贴选项时,然后用户单击复制div并粘贴,而无需使用angular6使用contenteditable选项。