marceljuenemann / angular-drag-and-drop-lists

Angular directives for sorting nested lists using the HTML5 Drag & Drop API
MIT License
2.16k stars 713 forks source link

How do I detect if item is being dropped into a container? #381

Open spreston077 opened 7 years ago

spreston077 commented 7 years ago

Hello,

I have created a call back function which is called by "dnd-drop" attribute.

In this function, I have access to "index". However, I can't see any way of checking if this index is within a container or a root index in the list?

Am I missing something?

kind regards, Sean

sighdok commented 7 years ago

Any new ideas?

Best regards, Joe

smithscripts commented 7 years ago

I would like to know also...

regards, Rob

nateeo commented 6 years ago

in your dnd-drop callback, you can get the event. Inside this event is the path - if your structure is fixed then you can easily check if it's nested inside a container or not (for example, anything dropped into a container returned true for event.path[4].nodeName === "LI"