I am using the Angular DragDropModule, and I want to drag an object from a list to another. This work perfectly, but I need my object to be dropped only at first or last index of the arrival list. The exemple here shows a list of numbers with an Enter Predicate that allows only elven numbers, but I wonder how I can resolve my problem.
I hope I was clear enough. If you know another way than using predicate to solve my problem it's also fine.
Thank you!
I think I just find a solution to my problem. The event cdkDropListDropped provide a "currentIndex" attribute that represent the index where the item has just been dropped so in the "drop" function, I just added the verification below, before transferring the item:
drop(event: CdkDragDrop<Object[]>) {
if (event.currentIndex === 0 || event.currentIndex === arrivalList.length) {
...
...
...
}
}
I hope I explained it well and that it will help someone.