Sandro Simas Sandro Simas - 4 months ago 148x
AngularJS Question

How to get pasted value using ngPaste directive when jquery is loaded before angular.js?

I'm having problems when i try to get the pasted data using ng-paste directive.

<input ng-model="evidence.url" ng-paste="getEvidenceInfos(evidence, $event.clipboardData.getData('text/plain'))">

When the jquery is loaded after angular, it works fine.

How to do when jquery is loaded before angular ?

<input ng-model="evidence.url" ng-paste="getEvidenceInfos(evidence, $event)">

$scope.getEvidenceInfos = function(evidence, event) {
$(event.currentTarget).val() // doesn't work
$( // doesn't work


When jQuery is loaded before angular, it is used within angular instead of jQuery lite which is built into angular. If full jQuery is used, you will receive a jQuery event. The raw event can be found in the property originalEvent.

$scope.getEvidenceInfos = function(evidence, event) {
    var pastedData = event.originalEvent.clipboardData;