I have several buttons,which's id is given by data that I ajax,and every id is different.
<a href="#" class="btn btn-primary likes" id="{{data.id}}" role="button" ng-click="likes()">XXX</a>
How do I detect a button's id when it is clicked?
I have several buttons,which's id is given by data that I ajax,and every id is different.
<a href="#" class="btn btn-primary likes" id="{{data.id}}" role="button" ng-click="likes()">XXX</a>
How do I detect a button's id when it is clicked?
you can use like this
data-ng-click='likes(data.id)'
or if you want pass the index of element
data-ng-click='likes($index)'