Issue
I call a function when a button is clicked in html in my angularjs app like below
<button type="button" class="btn" ng-click="foo(bar, fruits, {{user.email}})">Get it Done</button>
foo is a function in a controller, bar and fruits are values from a form and {{user.email}} is an email in scope.
I could get {{user.email}} displayed on the html page alright, but I get an undefined for it in the foo function of the controller, when the given button is clicked.
$scope.foo = function(bar, fruits, email) {
//email is undefined here
};
Could somebody help me understand how could I pass that {{user.email}} value to the foo function in the controller?
Solution
Please see here http://jsbin.com/mawey/1/edit. You don't have to interpolate user.email just:
<button type="button" class="btn" ng-click="foo(bar, fruits, user.email)">
Answered By - sylwester
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.