0

I want to copy item from A to B without hampering A at all. I am using copyArrayItem method for the same. When I am dragging item from a to B, then that item is getting removed from A before it is dropped into B. How can I prevent that behavior before dropping as cdkdragdrop is removing that item. This is happening after the (cdkDropListExited) event at A and before the (cdkDropListEntered) event at B.

For code I am referring stack blitz link : https://stackblitz.com/edit/angular-cdk-drag-drop?file=app%2Fcdk-drag-drop-connected-sorting-example.css,app%2Fcdk-drag-drop-connected-sorting-example.html

jitenderd
  • 181
  • 3
  • 15
  • I think you have to use copyArrayItem function for that, instead of transferArrayItem – Maciej Wojcik Aug 05 '22 at 10:04
  • I believe this is the exact answer to your problem: https://stackoverflow.com/a/63844707/3995346 – Maciej Wojcik Aug 05 '22 at 10:05
  • @MaciejWojcik Thanks but my question is little further. I am currently using copyArrayItem through which I am able to get the functionality of duplicating item. But my question is to prevent removing of item from source while I am entering into destination on drag. Please refer the example to check the behavior. – jitenderd Aug 05 '22 at 10:09
  • 1
    well, this stackblitz https://stackblitz.com/edit/angular-o8exzv-jauhhi?file=src%2Fapp%2Fcdk-drag-drop-connected-sorting-example.html does that? – Maciej Wojcik Aug 05 '22 at 10:12

0 Answers0