omridevk / ng-keyboard-shortcuts

Dead Simple Keyboard Shortcuts Management for Angular

Home Page:https://ng-keyboard-shortcuts.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use KeyboardShortcutsHelpService singleton across multiple Modules

paolocezar91 opened this issue · comments

Greetings,

I'm having problems getting the expected result from the KeyboardShortcutsHelpService across multiple Module.

The structure I'm working is something like this:

  • ui.module.ts - handles generic components, services. it imports KeyboardShortcutsModule.forRoot() and exports it, and some components register their shortcuts
  • ui-table.ts - table has its own module, it also imports KeyboardShortcutsModule.forRoot() and the table component has it's own shortcuts
  • Both are imported by shared.modules.ts and used in the rest of the app, which also has their own shortcuts.

My aim is to aggregate all shortcuts to show all active in our custom modal, by subscribing toKeyboardShortcutsHelpService. However, it seems that each module has its own instance of the KeyboardShortcutsService and so if I use the HelpService I only get the list of shortcuts created under the scope of that module. I also tried the component you guys provide but it does the same thing.

What can I do to circumvent this?

Thanks.

Sorry ignore this as I resolved this importing this correctly.

Regards.