Gathering detailed insights and metrics for angular-clipboard
Gathering detailed insights and metrics for angular-clipboard
Gathering detailed insights and metrics for angular-clipboard
Gathering detailed insights and metrics for angular-clipboard
npm install angular-clipboard
87.6
Supply Chain
92.3
Quality
75.4
Maintenance
50
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
193 Stars
103 Commits
53 Forks
10 Watching
2 Branches
12 Contributors
Updated on 04 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
26.7%
1,981
Compared to previous day
Last week
11.3%
10,124
Compared to previous week
Last month
0.4%
42,191
Compared to previous month
Last year
-23.8%
517,148
Compared to previous year
1
5
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.
1$ npm install angular-clipboard --save
angular-clipboard has no other dependencies than Angular itself.
Require angular-clipboard as a dependency for your app:
1angular.module('MyApp', ['angular-clipboard']) 2 .controller('MyController', ['$scope', function ($scope) { 3 $scope.supported = false; 4 5 $scope.textToCopy = 'I can copy by clicking!'; 6 7 $scope.success = function () { 8 console.log('Copied!'); 9 }; 10 11 $scope.fail = function (err) { 12 console.error('Error!', err); 13 }; 14 }]);
Copy text from an input field by clicking a button:
1<input type="text" ng-model="textToCopy"> 2<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.
1angular.module('MyApp', ['angular-clipboard']) 2 .controller('MyController', ['$scope', 'clipboard', function ($scope, clipboard) { 3 if (!clipboard.supported) { 4 console.log('Sorry, copy to clipboard is not supported'); 5 } 6 7 $scope.clickHandler = function () { 8 clipboard.copyText('Copy this text'); 9 }; 10 }]);
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.
1import clipboardModule from 'angular-clipboard'; 2 3angular.module('mymodule', [clipboardModule.name]);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 8/23 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
44 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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