I have a draggable element for which I have used cdkDrag
and it is working fine for me. Now, I need to toggle a flag on click of the element. But when I drag the element and on drop the click event triggers. Can you please suggest how to work with cdkDrag
and click
together. Sharing the code snippet for the same.
<div class="draggable-content" cdkDragBoundary=".drop-area" cdkDrag>
<div class="min-workspace-view" *ngIf="showMinWorkspace === true">
<mat-icon svgIcon="workspace" class="workspace-icon"
(click)="$event.stopPropagation(); showMinWorkspace = !showMinWorkspace">
</mat-icon>
</div>
</div>
The expectation is: when the element dragged then click should not trigger. when the element is just clicked then drag event should not trigger.