Update:
I've created a stackblitz to reproduce the problem.
Consider the following static template I have:
<div class="websiteleftColumn" cdkDropList #left="cdkDropList"
[cdkDropListConnectedTo]="[right]">
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
</div>
<div class="websiteRightColumn" cdkDropList #right="cdkDropList"
[cdkDropListConnectedTo]="[left]">
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
<div class="panelWithMuchContent" cdkDrag> much HTML </div>
</div>
I would expect to be able to freely reorder the panels in both columns and also between the two. Instead, I'm able to drag the panels, but as soon as I drop one, nothing happens, it moves back to its original state.
A guess it's because there is no data model behind. In the examples, the draggable divs are rendered on the page by *ngFor
from an array. And there's also a drop(event: CdkDragDrop<string[]>)
component method bound to them that updates the data model every time a drop happens.
But my problem is that I don't just have so simple list elements that I could put in some array, but entire parts of the website with much HTML code inside that I want to drag.
How could I create a data model for it? (if it's really that Angular's missing)