Latest web development tutorials

AngularJS ng-keydown instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

Press the button to execute the code:

<Input ng-keydown = "count = count + 1" ng-init = "count = 0" />

<H1> {{count}} </ h1>

try it"

Definition and Usage

ng-keydown tell AngularJS instructions for operating a key is pressed on the specified HTML element needed.

Nativeng-keydown directive does not cover elements onkeydown event, the event is triggered, ng-keydownexpression and native onkeydown event will be executed.

Button tap sequence of events:

  1. Keydown
  2. Keypress
  3. Keyup

grammar

<Element ng-keydown = "expression "> </ element>

<Input>, <select>, <textarea>, and other editable elements support this instruction.


Parameter Value

value description
expression Press the button to execute the expression.

AngularJS Reference Manual AngularJS Reference Manual