ngx-clipboard , F.K.A angular2-clipboard
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
- Angular >=6.0.0
If you need to use it on 2.x, please use version 7.x.x. If you need to use it on 4.x, please use version 8.x.x. If you need to use it on 5.x, please use version 10.x.x.
The code are pretty much the same, in 8.0.0 it uses InjectionToken which requires angular4 and above.
You can get it on npm.
npm install ngx-clipboard --save
1. npm i
2. npm run build
To run demo code locally
npm run start
If you use SystemJS to load your files, you might have to update your config:
System.config({
map: {
'ngx-clipboard': 'node_modules/ngx-clipboard'
}
});
This library support 2 kinds of copy source.
You can either set
[cbContent]="'target string'"
Or
[ngxClipboard]="inputTarget"
Or
You can just use copyFromContent from clipboard.service to copy any text you dynamically created.
PLEASE CHECK WITH PLUNKER FIRST
- Your commits conform to the conventions established here
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 6.0.1.