1

I am struggling with the following use case for Angular CDK Drag and Drop: I want the second drop list to be an array with empty elements when the component loads (because I want to have a number of placeholders there that can be replaced by the elements dragged from the first list).

I created a sandbox here: https://codesandbox.io/embed/angular-iiuhq?fontsize=14

I think the code is ok as idea (although for some reason I cannot get it to work in the sandbox). The only problem is that the dragging is super unnatural and choppy. I'd want the placeholder to remain visible until I dragged the element on top of it, then disappear beneath the dragged element. Now, it seems like the dragged element pushes the others left and right or up and down and then one of the placeholders disappears.

Maybe you guys have a better approach that I didn't think about.

Also, I know about the *cdkDragPlaceholder directive, but it was not obvious to me how I could use it in one of the drop lists and make the placeholders visible there always (so not only when the drag event starts).

1 Answer 1

0

I used one cdkDropList per element for simular task: stackBlitz

Sign up to request clarification or add additional context in comments.

2 Comments

I ended up doing that too in the end. Your example is not working, btw
Thanks for testing it) It works it just needs >1430px browser window . angular-srg6e3.stackblitz.io

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.