ngx-zeroclipboard
v1.0.0
Published
ZeroClipboard for angular
Downloads
9
Maintainers
Readme
ngx-zeroclipboard
ZeroClipboard for angular
Demo
Features
- lazy load zeroclipboard.js
Usage
1. Install
npm install ngx-zeroclipboard --save
import UEditorModule
import { ZeroClipboardModule } from 'ngx-zeroclipboard';
@NgModule({
imports: [
BrowserModule,
ZeroClipboardModule.forRoot({
// ZeroClipboard.js URL
path: './assets/zeroclipboard/dist/ZeroClipboard.js',
// Configuration Options
// see:https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/api/ZeroClipboard.md#configuration-options
config: {
title: 'Copy me!'
}
})
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
2、Template
<button type="button" class="btn btn-primary"
zeroclipboard [zcData]="data" [zcType]="'text'" #copy="zcDirective"
(ready)=""
(beforecopy)=""
(copy)=""
(aftercopy)=""
(destroy)=""
(error)="">Copy</button>
| Name | Type | Default | Summary | | ------- | ------------- | ----- | ----- | | zcData | string | | copy data | | zcType | 'text' | 'html' | 'richText' | 'text' | | | ready | Function | | | | beforecopy | Function | | | | copy | Function | | | | aftercopy | Function | | | | destroy | Function | | | | error | Function | | |
Directive Instance
@Component({
template: `<button zeroclipboard [zcData]="data" #copy="zcDirective">Copy</button>`
})
export class DemoComponent {
@ViewChild('copy') copy: ZeroClipboardDirective;
}
Document
interface ZeroClipboardDirective {
/**
* 获取Zeroclipboard实例
*/
get Instance(): any {}
/**
* 重新设置全局配置
*/
reConfig(cog: ZeroClipboardGlobalConfig) {}
}
Troubleshooting
Please follow this guidelines when reporting bugs and feature requests:
- Use GitHub Issues board to report bugs and feature requests (not our email address)
- 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)