Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
org.webjars.bowergithub.omichelsen:angular-clipboard
Advanced tools
Copy text to clipboard by clicking a button without using Flash. This is using the Selection API and Clipboard API available in newer browsers.
Browser support: Chrome 43+, Firefox 41+, Opera 29+, IE10+, Safari 10+ and Mobile Safari 10+.
See the demo.
$ npm install angular-clipboard --save
angular-clipboard has no other dependencies than Angular itself.
Require angular-clipboard as a dependency for your app:
angular.module('MyApp', ['angular-clipboard'])
.controller('MyController', ['$scope', function ($scope) {
$scope.supported = false;
$scope.textToCopy = 'I can copy by clicking!';
$scope.success = function () {
console.log('Copied!');
};
$scope.fail = function (err) {
console.error('Error!', err);
};
}]);
Copy text from an input field by clicking a button:
<input type="text" ng-model="textToCopy">
<button clipboard supported="supported" text="textToCopy" on-copied="success()" on-error="fail(err)">Copy</button>
You can supply a method to be called for the on-copied
and on-error
event. The on-error
function will be called with the error object as argument err
.
The optional supported
property can be used to detect browser support for the clipboard feature.
You can also invoke the copy to clipboard action directly by injecting the clipboard
service. Just remember it has to be in a click event, as clipboard access requires user action.
angular.module('MyApp', ['angular-clipboard'])
.controller('MyController', ['$scope', 'clipboard', function ($scope, clipboard) {
if (!clipboard.supported) {
console.log('Sorry, copy to clipboard is not supported');
}
$scope.clickHandler = function () {
clipboard.copyText('Copy this text');
};
}]);
If you are using a module loader, you can import the module name when requiring it in angular. Works with any AMD/UMD/CommonJS module loader.
import clipboardModule from 'angular-clipboard';
angular.module('mymodule', [clipboardModule.name]);
FAQs
WebJar for angular-clipboard
We found that org.webjars.bowergithub.omichelsen:angular-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.