As given in this answer, We need to pass and $event object to the ng-click function, and access the target element using
$scope.setMaster = function(obj, $event){
console.log($event.target);
}
While event.target isn't a cross-browser property. To overcome this, quirksmode suggests the following
function doSomething(e) {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
}
Is there any other/better way of getting target element? Like when we bind using DOM/jQuery method, we can use this keyword to refer to clicked element.
Please suggest.