Rebind ng-click event

74 Views Asked by At

I implemented drag and drop directives which work on a button. In my drop directive I use preventDefault() which is needed for the functionality of dropping elements on the button. However, this button has also ng-click directive which still needs to work when I click on the that button. How can I rebind the click event with the same implementation in the corresponding controller?

Here is my dropOnMe directive:

export default function () {
    "ngInject";

    return {
        restrict: 'A',
        scope: {
            myDragOver: '&jpDragover',
            myDrop: '&jpDrop',
        },
        link: function(scope, element, attrs) {
            element.on('dragover', function(event) {
                event.preventDefault();
                scope.myDragOver({event: event});
            });
            element.on('drop', function(event) {
                event.target.innerHTML = ++event.target.innerHTML ;
                scope.myDrop({event: event});
            });
        }
    }
}
0

There are 0 best solutions below