ng-focus
Handler for focus event
Description
The ng-focus directive allows you to specify custom behavior when an element
is focused.
Parameters
ng-focus
Type: Expression
Description: Expression to evaluate upon focus event. FocusEvent object is available as
$event.Example:
<div ng-focus="$ctrl.greet($event)"></div>
Demo
<section ng-app>
<input
type="text"
ng-focus="count = count + 1"
ng-init="count = 0"
placeholder="Click or tab into me"
/>
Focused {{ count }} times
</section>
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.