Skip to content

Instantly share code, notes, and snippets.

@EpokK
Created July 20, 2013 10:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EpokK/6044633 to your computer and use it in GitHub Desktop.
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
Copy link
Author

EpokK commented Jul 26, 2013

Necessite jQuery

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