The thing I already know: call a controller function without arguments inside a directive. The code is as below.
First in the directive definition:
scope: {
actionFunc: "&"
}
In the directive template:
<button ng-click='actionFunc()'></button>
Then in controller's HTML view
<my-directive action-func='controllFunction()'>
Then in controller
$scope.controllFunction= function() {
alert("controllFunction is called");
};
The code above works well.
However, I want to pass arguments to the actionFunc. The controller should look like this:
$scope.controllFunction= function(arg1, arg2) {
alert(arg1);
alert(arg2);
};
How to write the HTML view and directive?