Created
May 7, 2017 05:20
-
-
Save singhmohancs/a946e4ebf4f0b51ad0bbde4484528a7e to your computer and use it in GitHub Desktop.
AngularJs Focus Directive
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
angular.directive('autoFocus', function(){ | |
return function(scope, element){ | |
element[0].focus(); | |
}; | |
}); | |
/* | |
<div> | |
<input type="text" auto-focus /> | |
</div> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment