Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ngx-copy-to-clipboard
Advanced tools
Changelog
[2.3.0][] - 2020-12-09
Readme
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)
FAQs
Your module to copy content to clipboard in Angular applications easier
The npm package ngx-copy-to-clipboard receives a total of 408 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.