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
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.
删除括号{{ }}
,
ng-click="ApproveUser(user.ID)"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.