Skip to content

Instantly share code, notes, and snippets.

@travisjeffery
Created May 3, 2012 18:49
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>
@pbojinov
Copy link

short, sweet and gets the job done

@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