Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

goodeggs/ng-focus-on

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>
angular.module('yourModule', [
  ...

  'focusOn',
  ...
]);


...


function AwesomeCtrl($scope, focus) {
  $scope.focusAwesome = function($event) {
    $event.preventDefault();
    focus('awesome');
  };
}

Installing

Credit

Thanks to this answer from blesh on StackOverflow for inspiration: http://stackoverflow.com/a/18295416/298584

Contributing

npm install
npm test

License

MIT.