maxisam / ngx-clipboard

A pure angular clipboard directive
http://maxisam.github.io/ngx-clipboard/
MIT License
505 stars 93 forks source link

What is the correct way to use clipboard service destroy? #268

Closed ShivamShokeen closed 3 years ago

ShivamShokeen commented 3 years ago
@ViewChild('container')container:ElementRef;

copyText(){
    this._clipboardService.copy(this.container.nativeElement.innerText);
  }
  clear(){
   this._clipboardService.destroy(this.container.nativeElement.innerText)
  }

I want to clear the copied text for that I am using destroy but it was giving an error of

container.removeChild is not a function

Can you tell me how to use destroy function. I can also use below code but this is not what I want

this._clipboardService.copy(' ');

Thank you :)

maxisam commented 3 years ago

Because it is not designed for you to use it. this._clipboardService.copy(' '); I think it is what you can do. If you have more question, please ask in Stackoverflow.