Latest web development tutorials
 

AngularJS ng-keyup Directive


Example

Execute an expression at every keystroke:

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

<h1>{{count}}</h1>
Try it Yourself »

Definition and Usage

The ng-keyup directive tells AngularJS what to do when the keyboard is used on the specific HTML element.

The ng-keyup directive from AngularJS will not override the element's original onkeyup event, both will be executed.

The order of a key stroke is:

1. Keydown

2. Keypress

3. Keyup


Syntax

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

Supported by <input>, <select>, <textarea>, and other editable elements.


Parameter Values

Value Description
expression An expression to execute when a keypress is finished.