alfresco-ng2-components/docs/core/services/clipboard.service.md
2023-01-02 14:00:01 +00:00

2.0 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Clipboard service v3.2.0 Active 2019-04-12

Clipboard service

Copies text to the clipboard.

Class members

Methods

  • copyContentToClipboard(content: string, message: string)
    Copies a text string to the clipboard.
    • content: string - Text to copy
    • message: string - Snackbar message to alert when copying happens
  • copyToClipboard(target: HTMLInputElement|HTMLTextAreaElement, message?: string)
    Copies text from an HTML element to the clipboard.
  • isTargetValid(target: HTMLInputElement|HTMLTextAreaElement): boolean
    Checks if the target element can have its text copied.

Details

Use copyContentToClipboard to copy a text string or isTargetValid and copyToClipboard to copy the content of an HTML element in the page. The message parameter specifies a snackbar message to alert the user when the copying operation takes place.

See also