I'm trying to get value or index of the item removed from the source list using the "cdkDropListExited" event. I do see the event getting fired but the "event.item.data" keeps coming as "undefined".
How can I get the value or index of a list item as soon as it is moved from a drop container into another one.
Demo/Example here
CodePudding user response:
Well, that is simply beause you're not assigning any data to you cdkDrag.
Take a look at the docs here and look for cdkDragData
.
So, in your code it would like this:
<div *ngFor="let item of todo" cdkDrag [cdkDragData]="item">{{item}}</div>