Reputation: 650
I have a directive for an input field in Angular2 application. I want to stop Paste or Ctrl+V to the host of this directive so I used following code and the code is working perfectly.
@HostListener('paste', ['$event']) blockPaste(e: KeyboardEvent) {
e.preventDefault();
}
I also want to stop Drop event to that host. How can I do It?
Upvotes: 1
Views: 650
Reputation: 650
I got it by guess. It is working.
@HostListener('drop', ['$event']) blockDrop(e: MouseEvent) {
e.preventDefault();
}
Upvotes: 2
Reputation: 4971
@HostListener('mousedown', ['$event']) blockMouseDown(e: MouseEvent) {
e.preventDefault();
}
I hope it might help.
Upvotes: 2