javascript - Undefined Passing $event to function from angularjs directive -
i'm trying pass $event
context function @ controller, receive undefined param
my code:
directive('setting', function() { return { restrict: 'e', template: ` <div class='dropdown setting'> <button type='button'> {{getsettinghtml($event)}} </button> </div> };
and controller function:
$scope.getsettinghtml = function(e) { console.log(e); }; // return e == undefined
with {{getsettinghtml('xxx')}}
got right string.
how can target call function?
thanks!
where $event coming from? click on button? if so, $event going first argument of onclick event, this:
<button ng-click="getsettinghtml($event)">click me!</button>
Comments
Post a Comment