I have an angular directive that allows a callback to be passed in the following manner:
angular
.module('app')
.directive('myDirective', myDirective);
function myDirective() {
return {
bindToController: {
buttonClick: '&'
},
controller: 'MyController',
controllerAs: 'vm',
restrict: 'E',
scope: {},
templateUrl: '<div><button data-ng-click="vm.buttonClick(\'hello\')">Click me</button>'
};
}
Then in my parent HTML, I have
<my-directive button-click="ctrl.myCallback()"></my-directive>
Then finally in my parent controller, I have
function myCallback(msg) {
alert('message is: ' + msg);
}
The goal is to display "hello" or whatever data was passed to the callback, however this is not working.
Am I doing something wrong? It works when no arguments are specified
Thanks
FYI here is link to Plunker (http://plnkr.co/edit/F6TafMWD3EWqVCCLaMys?p=preview)
MyControllercode?