2020-05-03 00:14:42 +02:00

27 lines
739 B
TypeScript

import { Component, Input, OnInit } from '@angular/core';
import { ClipboardService } from 'ngx-clipboard';
import { MessageService } from 'primeng/api';
@Component({
selector: 'app-copy-text',
templateUrl: './copy-text.component.html',
styleUrls: ['./copy-text.component.scss'],
})
export class CopyTextComponent implements OnInit {
@Input() public textToCopy: string;
public displayContentToCopy = false;
constructor(private _clipboardService: ClipboardService, private messageService: MessageService) {}
ngOnInit(): void {}
public copy(): void {
this._clipboardService.copyFromContent(this.textToCopy);
this.messageService.add({
severity: 'success',
summary: 'Texte copié',
detail: this.textToCopy,
});
}
}