Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ng-clipboard-antd

cipchk54MIT2.0.1TypeScript support: included

A wrapper directive for clipboard.js, and base on ng-zorro-antd.

ng-clipboard-antd, angular-clipboard-antd, ng-clipboard, ng2-clipboard, angular-clipboard, angular2-clipboard, clipboard, ng-zorro-antd, antd

readme

ng-clipboard-antd

A wrapper directive for clipboard.js, and base on ng-zorro-antd.

The core function is ported from clipboard.js(@zenorocha) & ngx-clipboard(@maxisam), thanks.

NPM version

Demo

Live Demo

1、Install

npm install ng-clipboard-antd --save

Import the NzClipboardModule in to your projects.

import { NzClipboardModule } from 'ng-clipboard-antd';

@NgModule({
    imports: [
        NzClipboardModule.forRoot()
    ]
})
export class AppModule { }

2、Usage

nz-clipboard

<button nz-button [nz-clipboard]="'Content from ng-clipboard-antd'">Copy</button>
Name Type Default Remark
[nzTarget] HTMLInputElement NzInputComponent | copy from a input or nz-input
[nzSuccessText] string 复制成功 text of the success
[nzErrorText] string 复制失败 text of the error
(nzSuccess) EventEmitter | a success callback
(nzError) EventEmitter | a error callback

NzClipboardService

constructor(private srv: NzClipboardService) {}

copy() {
    this.srv.copyFromContent(`time ${+new Date}`);
}

Troubleshooting

Please follow this guidelines when reporting bugs and feature requests:

  1. Use GitHub Issues board to report bugs and feature requests (not our email address)
  2. Please always write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.

Thanks for understanding!

License

The MIT License (see the LICENSE file for the full text)