I want to disable copy paste in a textarea using angularJs. I tried to do so with ng-paste, like so:
Controller:
angular.module(\'inputExample\', [
Try making a directive that listens fot the cut
, copy
, and paste
events and then prevent the default event action.
app.directive('stopccp', function(){
return {
scope: {},
link:function(scope,element){
element.on('cut copy paste', function (event) {
event.preventDefault();
});
}
};
});
Use by adding the attribute to the input box.
Plunker
You could also use the ng-copy
, ng-cut
and ng-paste
directives and directly cancel the event.
Plunker