Created
May 17, 2013 08:42
-
-
Save vladimir-ivanov/5597808 to your computer and use it in GitHub Desktop.
Blur directive in angular js style ;-)
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
var BlurDirective = function ($parse) { | |
return { | |
restrict: 'A', | |
link: function (scope, elm, attrs) { | |
var callback = $parse(attrs.blur); | |
elm.bind('blur', function (event) { | |
scope.$apply(function () { | |
callback(scope, {$event: event}); | |
}); | |
}); | |
} | |
}; | |
}; | |
BlurDirective.$inject['$parse']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment