I'm having some trouble binding a function defined in a controller with a callback function in a directive. My code looks like the following:
In my controller:
$scope.handleDrop = function ( elementId, file ) {
console.log( 'handleDrop called' );
}
Then my directive:
.directive( 'myDirective', function () {
return {
scope: {
onDrop: '&'
},
link: function(scope, elem, attrs) {
var myFile, elemId = [...]
scope.onDrop(elemId, myFile);
}
} );
And in my html page:
<my-directive on-drop="handleDrop"></my-directive>
Having no luck with the code above. From what I've read in various tutorials I understand I'm supposed to specify the arguments in the HTML page?