snippet
cdkDropListGroup
: This tag essentially groups the drag-and-drop lists so they can interact with each other.cdkDropList
: This directive turns a regular div into a drag-and-drop container.[cdkDropListData]
: This links the list to an array of data in your component. When items are moved, the CDK can update this data.(cdkDropListDropped)
: This event fires when an item is dropped into the list. You use this to update your data based on the new arrangement.[cdkDropListConnectedTo]
: This lets you specify other cdkDropList containers that items from this list can be dragged into. This is how you enable dragging between different lists.cdkDrag
: This directive makes an element draggable. Anything with this directive can be picked up and moved.cdkDropListGroup
is the overall play area.cdkDropList
is a specific container where things can be dropped.cdkDrag
makes individual items grabbable.[cdkDropListConnectedTo]
creates connections between containers, allowing you to move items from one to another.(cdkDropListDropped)
is how you know when and where something was dropped, so you can update your underlying data.dropItem()
handles moving items within the same list or transferring them between different lists, updating the corresponding data arrays.dropGroup()
handles reordering the main groups within their list.Angular Material |
Angular Material CDK |
CDK Drag And Drop |