{"id":13481692,"url":"https://github.com/maxisam/ngx-clipboard","last_synced_at":"2025-05-14T15:09:51.401Z","repository":{"id":9105183,"uuid":"60649224","full_name":"maxisam/ngx-clipboard","owner":"maxisam","description":"A pure angular clipboard directive","archived":false,"fork":false,"pushed_at":"2024-10-15T20:20:33.000Z","size":2649,"stargazers_count":509,"open_issues_count":16,"forks_count":95,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-29T13:12:07.610Z","etag":null,"topics":["angular","aot","clipboard","commitizen"],"latest_commit_sha":null,"homepage":"http://maxisam.github.io/ngx-clipboard/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxisam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":"ngx-clipboard","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-06-07T21:56:45.000Z","updated_at":"2025-04-03T09:49:39.000Z","dependencies_parsed_at":"2024-03-15T02:35:14.475Z","dependency_job_id":"b6963b61-9974-4f5d-a3d5-e32cc9f8ee43","html_url":"https://github.com/maxisam/ngx-clipboard","commit_stats":{"total_commits":339,"total_committers":38,"mean_commits":8.921052631578947,"dds":0.1976401179941003,"last_synced_commit":"a50d7440797677fcb25a583eb76d564f0210b8e4"},"previous_names":["maxisam/angular2-clipboard"],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxisam%2Fngx-clipboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxisam%2Fngx-clipboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxisam%2Fngx-clipboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxisam%2Fngx-clipboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxisam","download_url":"https://codeload.github.com/maxisam/ngx-clipboard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812826,"owners_count":21647974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","aot","clipboard","commitizen"],"created_at":"2024-07-31T17:00:54.307Z","updated_at":"2025-05-14T15:09:51.367Z","avatar_url":"https://github.com/maxisam.png","language":"TypeScript","funding_links":["https://opencollective.com/ngx-clipboard","https://opencollective.com/ngx-clipboard/contribute","https://opencollective.com/ngx-clipboard/organization/0/website","https://opencollective.com/ngx-clipboard/organization/1/website","https://opencollective.com/ngx-clipboard/organization/2/website","https://opencollective.com/ngx-clipboard/organization/3/website","https://opencollective.com/ngx-clipboard/organization/4/website","https://opencollective.com/ngx-clipboard/organization/5/website","https://opencollective.com/ngx-clipboard/organization/6/website","https://opencollective.com/ngx-clipboard/organization/7/website","https://opencollective.com/ngx-clipboard/organization/8/website","https://opencollective.com/ngx-clipboard/organization/9/website"],"categories":["Awesome Angular [![Awesome TipeIO](https://img.shields.io/badge/Awesome%20Angular-@TipeIO-6C6AE7.svg)](https://github.com/gdi2290/awesome-angular) [![Awesome devarchy.com](https://img.shields.io/badge/Awesome%20Angular-@devarchy.com-86BDC1.svg)](https://github.com/brillout/awesome-angular-components)","Uncategorized"],"sub_categories":["Angular \u003ca id=\"angular\"\u003e\u003c/a\u003e","Uncategorized"],"readme":"[![Financial Contributors on Open Collective](https://opencollective.com/ngx-clipboard/all/badge.svg?label=financial+contributors)](https://opencollective.com/ngx-clipboard)\n[![ngx-clipboard](https://github.com/maxisam/ngx-clipboard/actions/workflows/ngx-clipboard.yml/badge.svg)](https://github.com/maxisam/ngx-clipboard/actions/workflows/ngx-clipboard.yml)\n[![npm](https://img.shields.io/npm/dt/ngx-clipboard.svg?style=flat-square)](https://www.npmjs.com/package/ngx-clipboard)\n[![GitHub release](https://img.shields.io/github/release/maxisam/ngx-clipboard.svg?style=flat-square)](https://github.com/maxisam/ngx-clipboard/releases)\n[![npm](https://img.shields.io/npm/l/ngx-clipboard.svg?style=flat-square)]()\n\n# ngx-clipboard , F.K.A [angular2-clipboard](https://www.npmjs.com/package/angular2-clipboard)\n\nFrom 6.0.0, there is no other JS dependency anymore. Just Angular.\n\nIt works with angular version 2.0.0 and up\n\nTo make more sense with the future versioning scheme of Angular, the directive selector is now rename to **ngxClipboard**\n\n## Dependencies\n\n-   If you need to use it on 2.x, please use version 7.x.x.\n-   If you need to use it on 4.x, please use version 8.x.x.\n-   If you need to use it on 5.x, please use version 10.x.x.\n-   If you need to use it on 8.x, please use version 12.x.x.\n-   If you need to use it on 9.x, please use version 13.x.x.\n-   If you need to use it on 10.x - 12.x, please use version 14.0.2.\n-   If you need to use it on 13.x, please use version 15.x.x. (Also thanks https://github.com/arturovt for updating \u0026 tuning)\n\nThe code are pretty much the same, in v8.0.0 it uses InjectionToken which requires angular4 and above.\n\n## Install\n\nYou can get it on npm.\n\n```bat\nnpm install ngx-clipboard --save\n```\n\nOpen your module file e.g `app.module.ts` and update **imports** array\n\n```ts\nimport { ClipboardModule } from 'ngx-clipboard';\n...\nimports: [\n...\n    ClipboardModule,\n...\n]\n```\n\n## Usage\n\nIf you use SystemJS to load your files, you might have to update your config:\n\n```js\nSystem.config({\n    map: {\n        'ngx-clipboard': 'node_modules/ngx-clipboard'\n    }\n});\n```\n\n### Copy source\n\nThis library support multiple kinds of copy source.\n\n-   Setting `cbContent` attribute\n\n```html\n\u003cbutton ngxClipboard [cbContent]=\"'target string'\"\u003eCopy\u003c/button\u003e\n```\n\nYou can assign the parent **container** to avoid focus trapper issue, #145\n\n```html\n\u003cdiv #container\u003e\n    \u003cbutton ngxClipboard [cbContent]=\"'target string'\" [container]=\"container\"\u003eCopy\u003c/button\u003e\n\u003c/div\u003e\n```\n\n-   Setting an input target\n\n```html\n....\n\n\u003cinput type=\"text\" #inputTarget /\u003e\n\n\u003cbutton [ngxClipboard]=\"inputTarget\"\u003eCopy\u003c/button\u003e\n```\n\n-   Using `copy` from `ClipboardService` to copy any text you dynamically created.\n\n```ts\nimport { ClipboardService } from 'ngx-clipboard'\n\n...\n\nconstructor(private _clipboardService: ClipboardService){\n...\n}\n\ncopy(text: string){\n  this._clipboardService.copy(text)\n}\n```\n\n### Callbacks\n\n-   `cbOnSuccess` callback attribute is triggered after copy was successful with `$event: {isSuccess: true, content: string}`\n\n```html\n\u003cbutton (cbOnSuccess)=\"copied($event)\" [cbContent]=\"'example string'\"\u003eCopied\u003c/button\u003e\n```\n\nOr updating parameters directly like so\n\n```html\n\u003cbutton (cbOnSuccess)=\"isCopied = true\" [cbContent]=\"'example string'\"\u003eCopied\u003c/button\u003e\n```\n\n-   `cbOnError` callback attribute is triggered when there's failure in copying with `$event:{isSuccess: false}`\n\n### Conditionally render host\n\nYou can also use the structural directive \\*ngxClipboardIfSupported to conditionally render the host element\n\n```html\n\u003cbutton ngxClipboard *ngxClipboardIfSupported [cbContent]=\"'target string'\" (cbOnSuccess)=\"isCopied = true\"\u003e\n    Copy\n\u003c/button\u003e\n```\n\n_Special thanks to @surajpoddar16 for implementing this feature_\n\n### Handle copy response globally\n\nTo handle copy response globally, you can subscribe to `copyResponse$` exposed by the `ClipboardService`\n\n```\nexport class ClipboardResponseService {\n  constructor(\n    private _clipboardService: ClipboardService,\n    private _toasterService: ToasterService\n  ) {\n    this.handleClipboardResponse();\n  }\n\n  handleClipboardResponse() {\n    this._clipboardService.copyResponse$.subscribe((res: IClipboardResponse) =\u003e {\n      if (res.isSuccess) {\n        this._toasterService.pop('success', undefined, res.successMessage);\n      }\n    });\n  }\n}\n```\n\n_Special thanks to @surajpoddar16 for implementing this feature_\n\n### Clean up temporary textarea used by this module after each copy to clipboard\n\nThis library creates a textarea element at the root of the body for its internal use. By default it only destroys it when the directive is destroyed. If you'd like it to be destroyed after each copy to clipboard, provide root level module configuration like this:\n\n```ts\nClipboardService.configure({ cleanUpAfterCopy: true });\n```\n\nSpecial thanks to [@DmitryEfimenko](https://github.com/DmitryEfimenko) for implementing this feature\n\n## Example\n\n[stackblitz.com](https://stackblitz.com/github/maxisam/ngx-clipboard)\n\n## Build project\n\n```cmd\nnpm i \u0026\u0026 npm run build\n```\n\nTo run demo code locally\n\n`npm run start`\n\n## Contributing\n\n-   Your commits conform to the conventions established [here](https://github.com/conventional-changelog/conventional-changelog-angular/blob/master/convention.md)\n\n## Troubleshooting\n\nPlease ask your general questions at https://stackoverflow.com/questions/tagged/ngx-clipboard\n\n## Shoutouts 🙏\n\nKudos to\n\n[Thierry Templier](http://stackoverflow.com/a/36330518/667767) This project is inspired by his answer on StackOverflow.\n\nThe core function is ported from [clipboard.js](http://zenorocha.github.io/clipboard.js/) by [@zenorocha](https://twitter.com/zenorocha).\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.\n\n\u003cimg src=\"https://www.browserstack.com/images/layout/browserstack-logo-600x315.png\" height=\"80\" title=\"BrowserStack Logo\" alt=\"BrowserStack Logo\" /\u003e\n\nBig thanks to [BrowserStack](https://www.browserstack.com) for letting the maintainers use their service to debug browser issues.\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n\u003ca href=\"https://github.com/maxisam/ngx-clipboard/graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n\n### Financial Contributors\n\nBecome a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/ngx-clipboard/contribute)]\n\n#### Individuals\n\n\u003ca href=\"https://opencollective.com/ngx-clipboard\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/individuals.svg?width=890\"\u003e\u003c/a\u003e\n\n#### Organizations\n\nSupport this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/ngx-clipboard/contribute)]\n\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/0/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/1/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/2/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/3/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/4/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/5/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/6/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/7/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/8/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/ngx-clipboard/organization/9/website\"\u003e\u003cimg src=\"https://opencollective.com/ngx-clipboard/organization/9/avatar.svg\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxisam%2Fngx-clipboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxisam%2Fngx-clipboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxisam%2Fngx-clipboard/lists"}