Mohamed Moqbel
Mohamed Moqbel

Reputation: 57

pass parameter angularjs to javascript function

Hello i want pass angularjs variable to javascript function

<div class="col-sm-6 col-lg-2" ng-repeat="x in names | filter:FilterModeFirst">
    <div class="row">
        <div class="col-sm-16 col--lg-12">
            <div class="callout">
                <small class="text-muted">{{x.name}}</small>
                <br>
                <small class="h6">{{x.Indx}}%</small>
                <img src="./img/Add.png" style="cursor:pointer" ID="imgAdd" onclick="AddServiceName(" {{x.name}} ")"/>
            </div>
        </div>
    </div>
</div>

Upvotes: 0

Views: 46

Answers (2)

Amal
Amal

Reputation: 278

angularjs provide ng-click for listening click event.

In your case, you can change the code to this:

ng-click="AddServiceName(x.name)"

Upvotes: 1

Sachila Ranawaka
Sachila Ranawaka

Reputation: 41447

use ng-click and remove the curly brackets.

ng-click="AddServiceName(x.name)"

Upvotes: 1

Related Questions