It's really simple actually. You can just get the text with element.val()
but you need to put it into setTimeout.
I did an example for you.
Working JSFiddle: http://jsfiddle.net/vxcjw45d/
HTML:
<body ng-app="myApp">
<div ng-controller="myController">
<textarea paste-example></textarea>
<div>{{ pastedText }}</div>
</div>
</body>
Javascript:
var myApp = angular.module('myApp', []);
myApp.controller('myController', function($scope) {
$scope.pastedText = '';
});
myApp.directive('pasteExample', function(){
var linkFn = function(scope, element, attrs) {
element.on('paste', function() {
setTimeout(function() {
console.log(element.val());
scope.pastedText = element.val();
scope.$apply();
}, 5);
});
};
return {
restrict: 'A',
link: linkFn
};
});