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 of which will be executed.

Example

Execute the expression when text is pasted into the input box:

<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 An expression that is executed when text is pasted into an element.