Reputation: 1842
I am trying to call a method defined in controller with bind variable.
<img src="close.png" style="widht: 34px; height: 23px; cursor: pointer;"
data-ng-click="hideDtls({{one}} , {{two}})">
Here one and two are defined in my controller and I can see in developer tools of browser that variables are getting their values but method is not being called. I have to send parameters as arguments to the method. (I know I can access them directly but it is due to implementation).
$scope.hideDtls(one , two)
{
// more logic here
}
Kindly let me know is it not allowed in angularJs to call a method with bind variable ? Thanks in advance
Upvotes: 0
Views: 420
Reputation: 123739
You do not perform interpolation ({{...}}
) for the scope properties passed in, the properties of the scope passed in as argument will automatically get evaluated against the scope. Otherwise it will result only in parse error. So just do:-
data-ng-click="hideDtls(one , two)"
also you have syntax error in your function declaration.
$scope.hideDtls = function(one , two){
// more logic here
}
Side note: Inline styles are bad, use css classes instead, and check your console for any errors.
Upvotes: 6