I'm trying pass $event context to function at controller, but receive undefined param
My code:
directive('setting', function() {
return {
restrict: 'E',
template: `
<div class='dropdown setting'>
<button type='button'>
{{getSettingHTML($event)}}
</button>
</div>
};
and my controller function:
$scope.getSettingHTML = function(e) {
console.log(e);
};
// return e == undefined
With {{getSettingHTML('xxx')}} I got right string.
How can I get the target which call to function?
Thanks!
$eventis not just some variable that always exist. It is created when an event happens, for example theng-click. I think you should make your question clearer; what are you trying to achieve? What do you want to do with the$event? What do you expect it to be?