I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

How To Access Element That Triggered Event In AngularJS 1.x

Posted by Weston Ganger

If your using angular and you want to access the DOM element that triggered the event but do not want to query the DOM to do so, then you can access it from your method like so.


<button type="button" ng-click="doWork($event)">Click This</button>

.controller("MyCtrl", function($scope){
  $scope.doWork = function($event){
    var element = angular.element($event.target);
  };
})


Related External Links:

Article Topic:Software Development - Angular

Date:November 15, 2016

Recommended Posts