AngularJS ng-keyup directive

Definition and Usage

ng-keyup The instruction tells AngularJS what operations to perform when using the keyboard on a specific HTML element.

of AngularJS ng-keyup Directives do not override the original onkeyup event of the element, both will be executed.

The order of keystrokes is:

  1. Keydown (key press down)
  2. Keypress (key press)
  3. Keyup (key release)

Example

Execute an expression each time a key is pressed:

<input ng-keyup="count = count + 1" ng-init="count=0" />
<h1>{{count}}</h1>

Try it yourself

Syntax

<element ng-keyup="expression</element>

Support <input>,<select>,<textarea> and other editable elements.

Parameters

Parameters Description
expression An expression to be executed when the key is completed.