Angular.js – using ng-blur
A simple Angular.js example of using ng-blur.
<!DOCTYPE html>
<html ng-app="testApp">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="Tizen Angular.js example"/>
<title>Tizen Angular.js example</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/angular.min.js"></script>
<script>
var app = angular.module('testApp', []);
app.controller('AppController', function($scope) {
$scope.inputData = '............';
$scope.focus = function() {
$scope.inputData = "You've focused me ;)";
}
$scope.blur = function() {
$scope.inputData = "You've focused me OUT :(";
}
}
);
</script>
</head>
<body>
<div ng-controller="AppController">
<p>Focus and focus out on the field below:</p>
<input ng-model="inputData" ng-focus="focus()" ng-blur="blur()" style='width: 300px'>
</div>
</body>
</html>