ganarajpr/angular-dragdrop — pull request #45 by Marc-Andre-Rivet (2014-07-16 19:50:42+00:00)
Title: Allow drop to validate the dragged content

Putting it out there to see if the change is of interest.

I'm essentially running into this situation where the drag and drop channels are the same for all my elements (say: 'ChannelA'); the drag&drop is used to merge similar elements together. Because of that, it is impossible to prevent an 'onDrop' from happening when dropping an element onto itself (invalid drop).

Proposed solution: Add a new dropValidate attribute (expecting a function) to the uiOnDrop directive and to make a local copy of the data (dataTransfer values are not accessible outside of dragStart and onDrop -- see http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents)

I thought of doing it on 'isDragEnter' (more efficient then doing all compatible drop elements upfront) but couldn't make it work.

Please do tell if I've missed something and doing this for nothing :-)