AngularJS ng-blur Directive

Definition and Usage

ng-blur directive tells AngularJS what operation to perform when the HTML element loses focus.

AngularJS's ng-blur Directive does not override the original onblur event of the element,ng-blur Both the expression and the original onblur event will be executed.

Example

An expression is executed when the input field loses focus (onblur):

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

Try It Yourself

Syntax

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

Support <a>,<input>,<select>,<textarea> as well as the window object.

Parameters

Parameters Description
expression Expression to be executed when the element loses focus.