@irshadali/ngx-copy-to-clipboard

2.0.6 • Public • Published

NgxCopyToClipboard

Click and copy to your clipboard fast


This version of ngx-copy-to-clipboard will install with higher versions of angular without testing. so, use this with your testing. Angular 18 introduces signals, if your component uses signals then testing must be done that it working correctly.

Why is there a need Copy to clipboard?

The "Copy to clipboard" directive is a useful feature that allows users to quickly and easily duplicate content from one location and paste it into another. It is particularly useful when working with text, as it eliminates the need to manually retype or reformat content.

npm


Installation

1. Install via NPM:

npm i --save @andreasnicolaou/ngx-copy-to-clipboard

2. Import NgxCopyToClipboardModule into your app's root module or common module

import { NgxCopyToClipboardModule } from '@andreasnicolaou/ngx-copy-to-clipboard';

@NgModule({
  ...
  imports: [
    NgxCopyToClipboardModule
  ],
  ...
})
export class AppModule { }

Inputs Description
textToCopy String Text to copy
successMessage On copy success message
errorMessage On copy error message
onCopyEvent On copy event get success message (has default message-ovverid)
onErrorEvent On copy event get error message (has default message-ovverid)

Example

    const val = 'Hello World!';

    public onSuccess(ev: string){
        console.log(ev);
    }

     public onError(ev: string){
        console.log(ev);
    }
    <button ngxCopyToClipboard [textToCopy]="val" [successMessage]="'Copied to Clipboard'" [errorMessage]="'Not copied to Clipboard'"
     (onCopyEvent)="onSuccess($event)" (onErrorEvent)="onError($event)">Copy</button>

Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repo, make your changes, and submit a pull request.

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you 😄

Package Sidebar

Install

npm i @irshadali/ngx-copy-to-clipboard

Weekly Downloads

12

Version

2.0.6

License

MIT

Unpacked Size

6.57 kB

Total Files

9

Last publish

Collaborators

  • irshadali