Skip to content
@ng-doc/app / Class

NgDocShortcutsService

Keyboard shortcuts of the documentation.

Single-key shortcuts (slash opens the search, the square brackets open the previous and next page, F focuses the filter of the page, L copies the link to the page and T switches between the light and the dark theme) are on by default. Readers turn them all off with one switch, and the choice is saved in the browser. A site turns them off by default with the shortcuts option of provideNgDocApp. They never run while the reader types in a field or holds Command, Control or Alt. Chords such as Command+K (Control+K) always work.

Decorators
@Service
DeclarationTypeScript
@Service()
export class NgDocShortcutsService { … }

Members

Constructor

1
()
—

Properties

1
enabled: Signal<boolean>
readonly

Whether single-key shortcuts are on: the reader's saved choice, or the site's default. Components hide the hints of single-key shortcuts while it is false.

Methods

4
(…): () => void

Registers a shortcut. When several shortcuts use the same key, the one registered last runs, so a page can take over a key while it is shown and give it back when it is destroyed.

(…): boolean

Runs the single-key shortcut registered for a key, as if the reader pressed it, even while single-key shortcuts are off. The search palette uses it for its actions.

(…): void

Turns single-key shortcuts on or off for this reader and saves the choice in the browser.

(): void

Turns single-key shortcuts off when they are on, and on when they are off.

Symbol
Kind
Class
Decorators
@Service
Scope
@ng-doc/app
Edit this page