Trying to implement a shortcut key combination for Command+S to save a form.
I\'ve read this - https://angular.io/guide/user-input, but it does not say anything about me
ngOnInit() {
document.body.addEventListener("keydown", event => {
let charCode = String.fromCharCode(event.which).toLowerCase();
switch (((navigator.platform.match('Mac') && event.metaKey) || event.ctrlKey) && event.shiftKey && charCode === 's') {
case true: {
this.saveArticle(); //whatever your usecase is
break;
}
}
});
}