I'm using ngx-clipboard to copy some text to clipboard in my Angular application.
constructor(
private clipboardService: ClipboardService,
) {
this.subscribeToClipboard();
}
subscribeToClipboard() {
this.clipboardService.copyResponse$.subscribe((res: IClipboardResponse) => {
console.log('res', res);
if (res.isSuccess) {
} else {
}
});
}
triggerOnClick(content) {
this.clipboardService.copyFromContent(content);
}
The contents are actually copied to the clipboard when triggerOnClick is called. But the subscription to copyResponse$ does not work and I do not get any value in it when copy is done.
Angular: 8.1.0
ngx-clipboard: 12.3.0
What could be going wrong here?