I have an angular directive with a pattern like this
<Button id="testBtn">Test me<button>
Then I have a directive controller where I have my API functions for the directive. Now I need to pass the event to the calling module that the button was clicked on. So that I can figure out what to do when a button is clicked in my base application.
Something like this should go in the baseApp controller.
$scope.myDirective = {
btnClick:function(){
}
}
My html template will look something like this:
<my-simpledirective='myDirective'></my-simpledirective>
I have a part where I can declare my configurations in $ scope.myDirective = {}, but how can I define an event definition there?
FYI: This is the way kendoUI does it, wants to do it the same way.
Something like this would also be acceptable
<my-simpledirective='myDirective' btn-clicked="myCustomClick"></my-simpledirective>
then in the controller baseApp
$scope.myCustomClick = function(){
}
source
to share