Latest web development tutorials

AngularJS ng-focus instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

When executing the expression input box gets the focus:

<Input ng-focus = "count = count + 1" ng-init = "count = 0" />

<H1> {{count}} </ h1>

try it"

Definition and Usage

ng-focus instruction is used to tell the operator AngularJS HTML element gain focus when you need to perform.

ng-focus command does not overwrite the original element onfocus event, the event is triggered, ng-focuswith the original expression onfocus event will be executed.


grammar

<Element ng-focus = "expression "> </ element>

<a>, <input>, <select>, <textarea>, and window objects support the directive.


Parameter Value

value description
expression Get the focus when executed expression elements.

AngularJS Reference Manual AngularJS Reference Manual