Is there a chance to implement a paste button in Angular.
FE: User copies a link of the website and on my page when he or she hits a button copied link should appear in a textbox.
Thanks!
Is there a chance to implement a paste button in Angular.
FE: User copies a link of the website and on my page when he or she hits a button copied link should appear in a textbox.
Thanks!
You can only copy from a webpage programmatically. You cannot programmatically paste anything because this is a security violation. However, you can add
(paste)="onPaste($event)"
to get the pasted clipboard details from control + v
Now is possible to read Clipboard from the new Clipboard Api like this:
navigator.clipboard.readText().then(
text => {
yourVariable = text;
}
)
.catch(error => {
console.error('Cannot read clipboard text: ', error);
}
);
A popup will appear asking to the user if they want to allow this operation.