According to Angular CDK Drag Drop Documentation, all the droppable items should be written with an *ngFor
directive iterating through an array. But what if the items that I want to make droppable are angular components? What is the procedure to make them droppable?
For example, the following code is to render a normal droppable div. What if I want to render multiple angular components on the 2nd line. In that case, I can't use the *ngFor
directive because every angular components are very different and I can't keep them in any array.
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
<div class="example-box" *ngFor="let movie of movies" cdkDrag>{{movie}}</div>
</div>
How can I do it like the following? (The following code doesn't work)
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
<widget-temperature cdkDrag></widget-temperature>
<widget-pressure cdkDrag></widget-pressure>
</div>
My main goal is to make a dashboard of widgets that the widgets are draggable and droppable. If anyone knows any suitable library besides Angular CDK Drag Drop that can be used for angular components please let me know.