AngularJS ng-blur example

AngularJS ng-blur expression is evaluated when an element (window, input, select, textarea, a) loses focus.

.blurClass {background-color: lightgray;}
<div ng-app="myApp" ng-controller='MyCtrl' ng-init="blur=false;">
  Click on input field and click somewhere else.
  <input type="text" ng-class="{blurClass: blur}" ng-blur="blur=true;" ng-focus="blur=false;"><br>

<script src="//"></script>
  var module = angular.module('myApp', []);
  module.controller('MyCtrl', function($scope) {});
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments