handleKeyPress method

  1. @HostListener('keypress')
void handleKeyPress(
  1. KeyboardEvent keyEvent
)

Implementation

@HostListener('keypress')
void handleKeyPress(KeyboardEvent keyEvent) {
  int keyCode = keyEvent.keyCode;
  if (keyCode == KeyCode.ENTER || isSpaceKey(keyEvent)) {
    toggleChecked();
    keyEvent.preventDefault();
    keyEvent.stopPropagation();
  }
}