Closed GenweiWu closed 6 years ago
xxx.module.ts
import { ClipboardModule } from 'ngx-clipboard';
imports:[ClipboardModule]
> xxx.component.ts
```ts
import { Component, OnInit, Renderer } from '@angular/core';
import { ClipboardService } from 'ngx-clipboard'
constructor(
private clipboardService: ClipboardService,
private renderer: Renderer,
) { }
copyContent(){
this.clipboardService.copyFromContent("copycontentXXX", this.renderer);
}
ngx-clipboard
为了适配
angular4
,需要使用较低版本的ngx-clipboard
,此次使用的版本:"ngx-clipboard": "8.1.1"