angular-mousetrap

AngularJS Service for dependency injection of mousetrap.js

Download .zip Download .tar.gz View on GitHub

An AngularJS wrapper for mousetrap.js whithout registering it in the global scope.

Demo

Type the key(s) '{{configs.keys}}': {{configs.typed}}

How to use

  1. Install angular-mousetrap-service via bower:
    bower install --save angular-mousetrap-service
  2. Include angular-mousetrap-service into your project.
  3. <script src="angular-mousetrap-service.min.js"></script>
  4. Add angular-mousetrap module in the dependencies of a angular module:
  5. angular.module('myApp', ['angular-mousetrap'])
  6. Inject the Mousetrap service into a controller, a directive, etc:
  7. angular.module('myApp', ['angular-mousetrap'])
    .controller('ExampleCtrl', ['$scope','Mousetrap',
        function($scope, Mousetrap){
            Mousetrap.bind('ctrl+s', function() {/*...*/});
        }
    ]);

How to contribute

I would to see this project living by pull requests.

License

The MIT License (MIT)

Copyright (c) 2015 Daniel Campos

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.