Clipboard

The Clipboard plugin provides access to the device clipboard, including copy and paste functionality.

Installation#

If you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.

Next, install the plugin:

npm install @ionic-enterprise/clipboard
npx cap sync

Index#

Classes#


Classes#

Clipboard#

usage:

import { Clipboard } from '@ionic-enterprise/clipboard/ngx';
constructor(private clipboard: Clipboard) { }
...
this.clipboard.copy('Hello world');
this.clipboard.paste().then(
(resolve: string) => {
alert(resolve);
},
(reject: string) => {
alert('Error: ' + reject);
}
);
this.clipboard.clear();

clear#

clear(): Promise<any>

Clear the text stored in clipboard

Returns: Promise<any> Returns a promise after the text has been cleaned


copy#

copy(text: string): Promise<any>

Copies the given text

Parameters:

NameTypeDescription
textstringText that gets copied on the system clipboard

Returns: Promise<any> Returns a promise after the text has been copied


paste#

paste(): Promise<any>

Pastes the text stored in clipboard

Returns: Promise<any> Returns a promise after the text has been pasted