Skip to content

Instantly share code, notes, and snippets.

View designingsean's full-sized avatar
🤨

Sean Ryan designingsean

🤨
View GitHub Profile
@designingsean
designingsean / ngGetFocus.js
Created June 30, 2013 15:01
AngularJS GetFocus directive. If the expression is truthy, then the element receives the focus.
app.directive('ngGetFocus', function() {
return {
restrict: 'A',
link: function(scope, element, attr){
scope.$watch(attr.ngGetFocus, function(value){
if(value)
element.focus();
});
}
};