funky-framadate-front/src/app/features/old-stuff/ui/copy-text/copy-text.component.ts

24 lines
714 B
TypeScript
Raw Normal View History

import { Component, Input, OnInit } from '@angular/core';
2020-05-01 19:10:17 +02:00
import { ClipboardService } from 'ngx-clipboard';
import { ToastService } from '../../../../core/services/toast.service';
@Component({
2020-04-22 12:56:18 +02:00
selector: 'app-copy-text',
2020-04-21 10:50:26 +02:00
templateUrl: './copy-text.component.html',
styleUrls: ['./copy-text.component.scss'],
})
export class CopyTextComponent implements OnInit {
2020-05-01 19:10:17 +02:00
@Input() public textToCopy: string;
public displayContentToCopy = false;
constructor(private _clipboardService: ClipboardService, private toastService: ToastService) {}
2020-05-01 19:10:17 +02:00
ngOnInit(): void {}
2020-05-01 19:10:17 +02:00
public copy(): void {
this._clipboardService.copyFromContent(this.textToCopy);
this.toastService.display(`Texte copié : ${this.textToCopy}`);
2020-04-21 10:50:26 +02:00
}
}