2

Suppose my html looks like

 <h2>Unapproved Users<span class="badge">12</span></h2>
<ul class="list-group" ng-repeat="user in unApprovedUsers">
    <li class="list-group-item">{{user.Name}} <button class="btn btn-success" ng-click="ApproveUser({{user.ID}})">Approve</button></li>

</ul>

the problem is that approve user cannot be called while sending that argument so how can i send it to the function

1

2 Answers 2

4

Remove brackets {{ }},

ng-click="ApproveUser(user.ID)"
Sign up to request clarification or add additional context in comments.

Comments

4

You do not need the {{ }}. You may directly access the user object and it's properties.

ng-click="ApproveUser(user.ID)"

The double curly braces binding expression({{ }}) tells Angular that it should evaluate the expression inside the double curly braces and insert the result into the DOM in place of the original binding expression .

Since you want to access the user object and pass the property value to your function, you do not need {{ }}. You can simply access the object and use the property value and pass it to your method.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.