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

Posted by Weston Ganger on November 15, 2016

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($;

Related External Links:

Posted in Angular and Tagged with angularjs 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts