0

I was writing a calculator program.

I want the program to catch "keyEvent" when I just press the key to the view directly.

How can I use the KeyEvent without input element?

This is my code.(with element).

<input type="text" ng-keydown="keyCheck($event)"/>

To use the Key Event without element, I tried to put the "ng-keydown " directive to body element. like this:

<body ng-keydown="keyCheck($event)">

However, Nothing has happened.

What do I have to do to use the keyEvent directly in screen?

What I want is that :

When I just put the key "7" without click to anywhere, my calculator sense it. That's what I want.

kboul
  • 13,836
  • 5
  • 42
  • 53
nujabes
  • 891
  • 2
  • 8
  • 17

0 Answers0