79365115

Date: 2025-01-17 14:50:50
Score: 1.5
Natty:
Report link

According to @Naren Murali says

Code should be the keycode mentioned in the below link:

Code values for keyboard events

But from trial and error I realized, that the documentation of angular do not match the behaviour (checked on 17-01-2025).

It could be a bug you should raise on angular github,

if you want to implement this feature,

instead of looking at code property of KeyboardEvent use the key property instead

...

I take the person's suggestion and my trial, I found that

  1. To detect alt + left shift key is pressed at same time, one has to use
  <input type="text" (keydown.shift.alt)="updateField($event)" />  
  1. The code snippets of Angular documentation has some error (may due to different version of docs and Angular-CLI that I've used at local device)
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Naren
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: GeeksMathGeeks