ng-focus-on

0.2.2 • Public • Published

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

Credit

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

Contributing

npm install
npm test

License

MIT.

Package Sidebar

Install

npm i ng-focus-on

Weekly Downloads

484

Version

0.2.2

License

MIT

Last publish

Collaborators

  • goodeggs-admin
  • demands