What is the ‘this’ object passed to an ng-click function call?
<span id="foo1" onclick="clicked(this)">...</span>
this argument to
clicked() is the
span object (
foo1) that is clicked.
When this code is converted to AngularJS, we attempt to pass the same
<span id="foo2" ng-click="clicked(this)">...</span>
Now, however, the argument passed to
clicked() is an object, but it does not appear to have any relation to the
So my questions are:
What is the value of
thiswhen passed to a function by
What is the easiest way to retrieve the clicked object within the function, or pass it into the function?
1. When passing
this as a parameter to a function in the
this will reference the current
For instance (example):