假设我在带有角度ng-click
事件的列表中有这个项目。
<a data-id='102' ng-click='delete()'>Delete</a>
如果那样,我如何获取数据/信息this
?
$scope.delete = function() {
var id = $(this).attr('data-id');
console.log(id); // I want to get 102 as the result
if (confirm('Are you sure to delete?')) {
$('#contactsGrid tr[data-id="' + id + '"]').hide('slow');
}
};