It's possible to intercept current event object in ng-click
like handlers by using $event
property.
But is it possible to get the element from which the method has been called?
like for example:
<div ng-controller='myController'>
<div>{{distortThatDiv($element)}}</div>
</div>
If you're going to manipulate the DOM, you really should be using a directive. However, if you have the $event
, you can get the raw element the event was triggered on easily:
$scope.clickHandler = function($event) {
var element = $event.target;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With