angularjs directive call function specified in attribute and pass an argument to it
问题 I want to create a directive that links to an attribute. The attribute specifies the function that should be called on the scope. But I also want to pass an argument to the function that is determined inside the link function. <div my-method='theMethodToBeCalled'></div> In the link function I bind to a jQuery event, which passes an argument I need to pass to the function: app.directive("myMethod",function($parse) { restrict:'A', link:function(scope,element,attrs) { var expressionHandler =