Skip to main content

HostListener to bind events

Keyboard shortcuts can also be bind using HostListener in a component This is a quick way to add shortcut to your application

Events are defined using the shortcut prefix and then the shortcut You can use sequences and combinations.

Usage

    import {HostListener} from '@angular/core';

@HostListener("shortcut.k + t")
onShortcut() {
console.log("shortcut clicked!!")
}