Angular: On Blur
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc8.js"></script>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<html ng-app="myapp">
<body ng-controller="Controller">
<input ng-blur="hello()" />
</body>
</html>
JavaScript
var myapp = angular.module('myapp',[]);
myapp.directive('ng-blur', function() {
return function(scope, element, attrs) {
element.bind('blur', function() {
scope.$eval(attrs.ng-blur);
});
}
});
function Controller($scope) {
$scope.hello = function() {
alert('hello');
}
}