Issue
As per core we used this
for get element but in AngularJS
we get $scope
context.
So, I tried this question but without success.
Here is my attempt:
Controller
$scope.clickMe = function(ele) {
console.log(ele);
console.log(ele.id);
};
HTML
<div class="input-group">
<input type="number" id="test-id" ng-blur="clickMe($event.target);">
</div>
How do I get the element in the function?
Solution
use : $event.currentTarget;
<div class="input-group">
<input type="number" id="test-id" ng-blur="clickMe($event);">
</div>
$scope.clickMe = function(ele) {
console.log(ele);
console.log(ele.currentTarget);
};
Fiddle" http://jsfiddle.net/h8to34ux/221/
Answered By - Ved
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.