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

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -