English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

AngularJS ng-blur instruction

AngularJS Reference Manual

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
<input ng-blur="count = count" + 1" ng-init="count=0" />
<h1>{{count}}</h1>
<p>In the example, the "count" variable records the number of times the focus is lost.</p>
</body>
</html>
Test to see ‹/›

Definition and Usage

ng-blur Directives are used to tell AngularJS which expression needs to be executed when the HTML element loses focus.

In AngularJS, ng-blur The directive does not override the native onblur event, If this event is triggered,ng-blur Both the expression and the native onblur event will be executed.

Syntax

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

 

Supports <a>, <input>, <select>, <textarea>, window object.

Parameter Value

ValueDescription
expressionExpressions executed when losing focus.

AngularJS Reference Manual