AngularJS ng-paste directive

Definition and Usage

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

The directive of AngularJS ng-paste The directive does not override the original onpaste event of the element, both 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 The expression to be executed when text is pasted into an element.