AngularJS ng-blurDirective

AngularJS 参考手册AngularJS Reference Manual


AngularJS Example

Execute an expression when the input field loses focus (onblur):

<input ng-blur="count = count + 1" ng-init="count=0" />

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

Try it »

Definition and Usage

ng-blurThis directive tells AngularJS what expression to execute when an HTML element loses focus.

In AngularJS,ng-blurthe directive does not override the native onblur event, if that event is triggered,ng-blurBoth the expression and the native onblur event will execute.


Syntax

<element ng-blur="expression"></element>

<a>, <input>, <select>, <textarea>, and window objects are supported.


Parameter Value

Value Description
expression The expression to execute when the element loses focus.

AngularJS 参考手册AngularJS Reference Manual

Other Extensions