
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
ngx-copy-to-clipboard
Advanced tools
Your module to copy content to clipboard in Angular applications easier
Your module to copy content to clipboard in Angular applications easier 🎯.
This is a common concept, but why use this directive instead solve it via server-side rendering?
The idea of this directive is make this process transparent and easier. So the main point is integrate this directive with other tooling process, such as:
You can integrate with WebSockets or handling this in a EventSourcing architecture. It's totally transparent for you and you can integrate easier in your application.
Try out our demo on Stackblitz!
You can get it on NPM installing ngx-copy-to-clipboard
module as a project dependency.
npm install ngx-copy-to-clipboard --save
You'll need to add NgxCopyToClipboardModule
to your application module. So that, the <ngx-copy-to-clipboard>
components will be accessible in your application.
...
import { NgxCopyToClipboardModule } from 'ngx-copy-to-clipboard';
...
@NgModule({
declarations: [
YourAppComponent
],
imports: [
...
NgxCopyToClipboardModule,
...
],
providers: [],
bootstrap: [YourAppComponent]
})
export class YourAppComponent {}
Now you just need to add a configuration in your components and, after that, you can use the ngx-copy-to-clipboard
component in your templates, passing the required attributes to make it work properly.
import { Component } from '@angular/core';
@Component({
selector: 'component-docs',
template: `
<section class="section">
<h2>Copying data from textarea element</h2>
<textarea name="text-content" id="text-content" rows="5" cols="33">
Demonstration content...
</textarea
>
<ngx-copy-to-clipboard
target="#text-content"
[action]="cut"
[success]="onSuccess"
[error]="onError"
>Copy</ngx-copy-to-clipboard
>
</section>
`,
})
export class ComponentDocsComponent {
copiedText = '';
constructor() {
this.onSuccess = this.onSuccess.bind(this);
this.onError = this.onError.bind(this);
}
onSuccess(e) {
this.copiedText = e.text;
}
onError(e) {
this.copiedText = 'Error trying to copy your text';
}
}
You should bind the
success
anderror
function callbacks before passing through the component to make sure your component will be running based on the same scope.
npm start
and access the link http://localhost:4200
in your browsernpm test
for run tests. In case you want to test using watch, please use npm run tdd
this project is using np
package to publish, which makes things straightforward. EX: np <patch|minor|major> --contents=dist/ngx-copy-to-clipboard
For more details, please check np package on npmjs.com
For any type of contribution, please follow the instructions in CONTRIBUTING.md and read CODE_OF_CONDUCT.md files.
Wilson Mendes (willmendesneto)
[2.3.0][] - 2020-12-09
FAQs
Your module to copy content to clipboard in Angular applications easier
The npm package ngx-copy-to-clipboard receives a total of 251 weekly downloads. As such, ngx-copy-to-clipboard popularity was classified as not popular.
We found that ngx-copy-to-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.