AngularJS ng-paste directive

Definition and Usage

ng-paste directive tells AngularJS what operation to perform when text is pasted into an HTML element.

AngularJS's ng-paste The directive does not override the original onpaste event of the element, both will be executed.

Example

When text is pasted into the input box, execute the expression:

<input ng-paste="count = count + 1" ng-init="count=0" value="Paste text here" />

Try it yourself

Syntax

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

Affected <input>,<select>,<textarea> and support for other editable elements.

Parameters

Parameters Description
expression Expression to be executed when text is pasted into an element.