Sometimes we need to access the attributes of event invoking DOM element. AngularJS proving $event directive to track events. we can find event invoking elements by using $event.target

Program Flow

  1. Pass $event while calling function
  2. Get element by using $event.target
  3. Make different type element operations like here

Program

$scope.displayHtml = function($event) {
   var myEl = angular.element($event.target);
   alert(myEl.html());
}

1 comment:

  1. I love this. It is soo informative. Are you also searching for cheap assignment writing services we are the best solution for you. We are best known for delivering the best services to students without having to break the bank

    ReplyDelete

Blogroll

Follow this blog by Email

Popular Posts