How to pass interpolated value as an argument into a javascript function in angularjs


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, {{}})">Get it Done</button>

foo is a function in a controller, bar and fruits are values from a form and {{}} is an email in scope.

I could get {{}} 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.

$ = function(bar, fruits, email) {
    //email is undefined here

Could somebody help me understand how could I pass that {{}} value to the foo function in the controller?


Please see here You don’t have to interpolate just:

<button type="button" class="btn" ng-click="foo(bar, fruits,">

Answered By – sylwester

Answer Checked By – David Marino (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.