Giter VIP home page Giter VIP logo

Comments (4)

chieffancypants avatar chieffancypants commented on June 13, 2024

They shouldn't be -- there are test cases to prevent that. Are you defining the hotkeys through the routing? You may just be setting up persistent hotkeys.

from angular-hotkeys.

ujovlado avatar ujovlado commented on June 13, 2024

Hi, thanks for response. Hotkeys are defined only in one controller, because only in that controller are needed. But I used ui-router (https://github.com/angular-ui/ui-router), maybe that causing a problem. I'll try to do the same with standard router.

from angular-hotkeys.

chieffancypants avatar chieffancypants commented on June 13, 2024

No -- controller-based hotkeys are persistent by default, as they are used for things like a navigation bar which is present on every page. It's related to #32 but can be fixed by manually specifying that the hotkey is not intended to be persistent. This is the method signature:

/**
 * Creates a new Hotkey and creates the Mousetrap binding
 *
 * @param {string}   combo       mousetrap key binding
 * @param {string}   description description for the help menu
 * @param {Function} callback    method to call when key is pressed
 * @param {string}   action      the type of event to listen for (for mousetrap)
 * @param {array}    allowIn     an array of tag names to allow this combo in ('INPUT', 'SELECT', and/or 'TEXTAREA')
 * @param {boolean}  persistent  if true, the binding is preserved upon route changes
 */
function _add (combo, description, callback, action, allowIn, persistent) {

So simply pass in persistent: false in the object or function argument that you pass to hotkeys.add:

hotkeys.add({
  combo: 'w',
  description: '....',
  callback: function() {},
  persistent: false
});

from angular-hotkeys.

ujovlado avatar ujovlado commented on June 13, 2024

I don't know how it happened, but it was browser-related issue ... in newer version it works fine. Thanks for help.

from angular-hotkeys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.