AngularJS ng-copy Directive

Definition and Usage

ng-copy directive tells AngularJS what to do when copying HTML elements.

AngularJS ng-copy Directive does not override the original oncopy event of the element,ng-copy Both the expression and the original oncopy event will be executed.

Example

Execute the expression when copying the text in the copy input box:

<input ng-copy="count = count + 1" ng-init="count=0" value="Copy this text" />

Try It Yourself

Syntax

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

All HTML elements support it.

Parameters

Parameters Description
expression An expression to be executed when the text of an element is copied.