How can I detect a Command or Option key press and a return key at the same time as ngKeypress?

I know I can do something like this:

<div class="contentView"
 ng-keypress="phs.keyEnter($event)">

keyEnter = ($event): void => {
    var a = $event;
    var b = $event.keyCode;
}

But is there a way I can determine if the Command or Option key is pressed simultaneously with the Return key?

0
source share
1 answer

The $ event indicates some keys pressed (e.g. ctrl, alt ...). https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent . Not sure about cmd, but check it out.

You can also combine ngKeypress and ngKeyup to check when the cmd key was pressed and the return key was released and determine when these events overlap.

0
source

All Articles