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

Latest commit

 

History

History
51 lines (35 loc) · 956 Bytes

README.md

File metadata and controls

51 lines (35 loc) · 956 Bytes

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.