Skip to content

Instantly share code, notes, and snippets.

@EpokK
Created July 20, 2013 10:48
Show Gist options
  • Select an option

  • Save EpokK/6044633 to your computer and use it in GitHub Desktop.

Select an option

Save EpokK/6044633 to your computer and use it in GitHub Desktop.
ngFocus
myApp.directive('ngFocus', function( $timeout ) {
return function( scope, elem, attrs ) {
scope.$watch(attrs.ngFocus, function( newval ) {
if ( newval ) {
$timeout(function() {
elem[0].focus();
}, 0, false);
}
});
};
});
@EpokK

EpokK commented Jul 26, 2013

Copy link
Copy Markdown
Author

Necessite jQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment