angular-dragdrop/angular-dragdrop

on-drop-failure will never execute if on-drop-success exist.

Closed this issue · 1 comments

From this (copied) part of code, you could see that on-drop-failure will never be executed if there is set on-drop-success.
Also, will never at all be executed for FAILURE because FAILURE should be executed when: e.dataTransfer.dropEffect === 'none'
So else should go for first if.

if (e.dataTransfer && e.dataTransfer.dropEffect !== 'none') {
                    if (attrs.onDropSuccess) {
                        var onDropSuccessFn = $parse(attrs.onDropSuccess);
                        scope.$evalAsync(function() {
                            onDropSuccessFn(scope, {$event: e});
                        });
                    } else {
                        if (attrs.onDropFailure) {
                            var onDropFailureFn = $parse(attrs.onDropFailure);
                            scope.$evalAsync(function() {
                                onDropFailureFn(scope, {$event: e});
                            });
                        }
                    }
                }