Gathering detailed insights and metrics for ngx-clipboard
Gathering detailed insights and metrics for ngx-clipboard
Gathering detailed insights and metrics for ngx-clipboard
Gathering detailed insights and metrics for ngx-clipboard
ngx-markdown
Angular library that uses marked to parse markdown to html combined with Prism.js for synthax highlights
@dllcn/ngx-clipboard
angular复制指令
ngx-copypaste
<a href="http://jsdaddy.io/img/logo.png"> <h1 align="center">NGX COPYPASTE</h1> </a>
ngx-copy-to-clipboard
Your module to copy content to clipboard in Angular applications easier
npm install ngx-clipboard
Typescript
Module System
Node Version
NPM Version
TypeScript (82.41%)
JavaScript (7.28%)
HTML (6.92%)
CSS (3.23%)
Shell (0.15%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
509 Stars
426 Commits
95 Forks
8 Watchers
19 Branches
31 Contributors
Updated on Jun 25, 2025
Latest Version
16.0.0
Package Id
ngx-clipboard@16.0.0
Unpacked Size
124.45 kB
Size
23.58 kB
File Count
20
NPM Version
6.14.17
Node Version
14.20.0
Published on
Apr 11, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
2
From 6.0.0, there is no other JS dependency anymore. Just Angular.
It works with angular version 2.0.0 and up
To make more sense with the future versioning scheme of Angular, the directive selector is now rename to ngxClipboard
The code are pretty much the same, in v8.0.0 it uses InjectionToken which requires angular4 and above.
You can get it on npm.
1npm install ngx-clipboard --save
Open your module file e.g app.module.ts
and update imports array
1import { ClipboardModule } from 'ngx-clipboard'; 2... 3imports: [ 4... 5 ClipboardModule, 6... 7]
If you use SystemJS to load your files, you might have to update your config:
1System.config({ 2 map: { 3 'ngx-clipboard': 'node_modules/ngx-clipboard' 4 } 5});
This library support multiple kinds of copy source.
cbContent
attribute1<button ngxClipboard [cbContent]="'target string'">Copy</button>
You can assign the parent container to avoid focus trapper issue, #145
1<div #container> 2 <button ngxClipboard [cbContent]="'target string'" [container]="container">Copy</button> 3</div>
1.... 2 3<input type="text" #inputTarget /> 4 5<button [ngxClipboard]="inputTarget">Copy</button>
copy
from ClipboardService
to copy any text you dynamically created.1import { ClipboardService } from 'ngx-clipboard' 2 3... 4 5constructor(private _clipboardService: ClipboardService){ 6... 7} 8 9copy(text: string){ 10 this._clipboardService.copy(text) 11}
cbOnSuccess
callback attribute is triggered after copy was successful with $event: {isSuccess: true, content: string}
1<button (cbOnSuccess)="copied($event)" [cbContent]="'example string'">Copied</button>
Or updating parameters directly like so
1<button (cbOnSuccess)="isCopied = true" [cbContent]="'example string'">Copied</button>
cbOnError
callback attribute is triggered when there's failure in copying with $event:{isSuccess: false}
You can also use the structural directive *ngxClipboardIfSupported to conditionally render the host element
1<button ngxClipboard *ngxClipboardIfSupported [cbContent]="'target string'" (cbOnSuccess)="isCopied = true"> 2 Copy 3</button>
Special thanks to @surajpoddar16 for implementing this feature
To handle copy response globally, you can subscribe to copyResponse$
exposed by the ClipboardService
export class ClipboardResponseService {
constructor(
private _clipboardService: ClipboardService,
private _toasterService: ToasterService
) {
this.handleClipboardResponse();
}
handleClipboardResponse() {
this._clipboardService.copyResponse$.subscribe((res: IClipboardResponse) => {
if (res.isSuccess) {
this._toasterService.pop('success', undefined, res.successMessage);
}
});
}
}
Special thanks to @surajpoddar16 for implementing this feature
This library creates a textarea element at the root of the body for its internal use. By default it only destroys it when the directive is destroyed. If you'd like it to be destroyed after each copy to clipboard, provide root level module configuration like this:
1ClipboardService.configure({ cleanUpAfterCopy: true });
Special thanks to @DmitryEfimenko for implementing this feature
1npm i && npm run build
To run demo code locally
npm run start
Please ask your general questions at https://stackoverflow.com/questions/tagged/ngx-clipboard
Kudos to
Thierry Templier This project is inspired by his answer on StackOverflow.
The core function is ported from clipboard.js by @zenorocha.
This project was generated with Angular CLI version 7.
Big thanks to BrowserStack for letting the maintainers use their service to debug browser issues.
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/12 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More