ng-focus-on
v0.2.2
Published
An angular directive for easy programmatic focusing on form elements
Downloads
1,052
Readme
ng-focus-on
An angularjs directive and corresponding factory to make elements focusable. It's easy!
<div ng-controller="AwesomeCtrl">
<a href="#" ng-click="focusAwesome($event)">Focus on something awesome</a>
<input focus-on="awesome">
</div>
function AwesomeCtrl($scope, focus) {
$scope.focusAwesome = function($event) {
$event.preventDefault();
focus('awesome');
};
}
Installing
- Bower:
bower install ng-focus-on
- npm/browserify:
npm install ng-focus-on
- Download: https://github.com/goodeggs/ng-focus-on/releases/latest
Credit
Thanks to this answer from blesh on StackOverflow for inspiration: http://stackoverflow.com/a/18295416/298584
Contributing
npm install
npm test
License
MIT.