Skip to content

Instantly share code, notes, and snippets.

@travisjeffery
Created May 3, 2012 18:49
Show Gist options
  • Save travisjeffery/2588075 to your computer and use it in GitHub Desktop.
Save travisjeffery/2588075 to your computer and use it in GitHub Desktop.
Angularjs Focus Directive
<script>
angular.directive('tj:focus', function(){
return function(scope, element){
element[0].focus();
};
});
</script>
<div>
<input type="text" ng:model="model" tj:focus />
</div>
@Werninator
Copy link

Wow, thank you for this simple solution! Gonna try it out.

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