ngx-zeroclipboard
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ngx-zeroclipboard

ZeroClipboard for angular

NPM version Build Status

Demo

Live 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'
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:

  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)

Package Sidebar

Install

npm i ngx-zeroclipboard

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • cipchk