ng2-dragula - Use the copy function only for a specific target?

184 Views Asked by At

How do I copy some thing instead of moving it only when dragging it to a specific target.

I have 4 containers, and I want to make the value get copied to a container when something is dragged to it. For all the other containers I just want the value to get moved from source to target (as is the default behaviour).

The copy function in the ng2-dragula docs has only the element and source as arguments, but no target.

How do I achieve this?

1

There are 1 best solutions below

0
On

You can create dragover event and change copy option function run time.

HTML

<div (dragover)="changeMethod()"></div>

TS

changeMethod(){
  // here write logic for change option for target.
  this.copyOption = false;
}

i hope this will helps.