2

I'm using angularjs 1.3.2. How to get clipboard data on paste event?

This question is like: "Paste" event in Angular [ngPaste]

But in this question, the angularjs version is 1.2. And this is not working in angularjs 1.3.2.

Thanks.

Community
  • 1
  • 1
Tavousi
  • 12,568
  • 15
  • 47
  • 65

1 Answers1

0

I made this plunkr in 1.3.17, the main things to take in account are:

  • You can pass the $event variable to your ngPaste handler in the view, which in turn has a method to get clipboard contents:

ng-paste="processCb($event)"

  • In the event handler, clipboard data can be accessed through the getData method

event.clipboardData.getData('Text')

edrpls
  • 136
  • 1
  • 12