Created
June 19, 2013 15:04
-
-
Save onel0p3z/5815022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Module.directive('ng-blur', function() { | |
return { | |
restrict: 'A', | |
link: function postLink(scope, element, attrs) { | |
element.bind('blur', function () { | |
scope.$apply(attrs.ngBlur); | |
}); | |
} | |
}; | |
}); | |
And use it in html template: | |
<input type="text" ng-blur="handleInputBlur()"></input> | |
And handle it in controller: | |
$scope.handleInputBlur = function(){ | |
// do some action here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment