AngularJS ng-copy Directive

Definition and Usage

ng-copy directives tell AngularJS what to do when copying HTML elements.

AngularJS ng-copy The 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.

Parameters

Parameters Description
expression Execute the expression when the text of the element is copied.