Reputation: 108
Is there a way to get the innerHTML of the element that triggers a ngFocus or ngBlur?
<textarea ng-focus="focus()"></textarea>
then in my controller I have
$scope.focus = function() {
//I need innerHTML here of the textarea that triggered me
}
Upvotes: 0
Views: 819
Reputation: 5166
focus(this)
will not pass DOM element to the function focus(this)
. Here this
will refer to the scope. If you want to access the DOM element use focus($event)
. In the callback function you can get the DOM element by event.target
Source copied from http://stackoverflow.com/a/13000154
Upvotes: 1
Reputation: 136144
You could use ng-model
on that text area. So while ng-focus
event gets fired you could get that value from scope
of the controller easily.
Upvotes: 0