An ng-paste is a custom directive to user expectation base. This directive very useful to real time development. Here i share some real experience for myself, we develop a online question and answer program exam event.
This application is not include copy and paste restriction for any piece of code from the exam event, But we analysis the user is using any copy paste piece of code from the question and answers means we get flag value. How we get a flag value is using ng-paste directive is listen the paste event flag value. This value is send to server and analysis how user response to genuine.
AngularJS:
var app = angular.module('PasteApp',[]);
app.controller('PasteCtrl', function($scope){
$scope.paste = false;
}) ;
HTML:
<div ng-app="PasteApp">
<div ng-controller="PasteCtrl">
<span>Write a program for date filter in angular?</span>
<textarea rows="4" cols="50" ng-paste="paste=true" >
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
{{paste}}
</div>
</div>
Result:
Demo
This application is not include copy and paste restriction for any piece of code from the exam event, But we analysis the user is using any copy paste piece of code from the question and answers means we get flag value. How we get a flag value is using ng-paste directive is listen the paste event flag value. This value is send to server and analysis how user response to genuine.
AngularJS:
var app = angular.module('PasteApp',[]);
app.controller('PasteCtrl', function($scope){
$scope.paste = false;
}) ;
HTML:
<div ng-app="PasteApp">
<div ng-controller="PasteCtrl">
<span>Write a program for date filter in angular?</span>
<textarea rows="4" cols="50" ng-paste="paste=true" >
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
{{paste}}
</div>
</div>
Result:
Demo
Comments
Post a Comment