so I have an example custom directives code
angular.module('myApp.directives', []).
directive('exampleDirective', ['version', function(version) {
return {
link:function(scope,elm,attr) {
elm.on('click',function() {
alert("clicked element")
});
}
}
}]);
and this is the markup html that I made
<example-directive></example-directive>
<button ng-click="click()">click me</button>
as you can see the button is outside the example-directive environment and as you can see the ng-click is defined and throw the click() function into controller.
my question is how can I get the alret("clicked element") from custom directive when I clicked the ng-click button in angularjs ?