- ng-cut is specify custom behavior on cut event.
How to apply ng-cut? <input ng-cut="cut=true" ng-init="cut=false; value='please cut me'" ng-model="value">
You just cut it: {{cut}}
- ng-paste is specify custom behavior on paste event.
How to apply ng-paste? <input ng-paste="paste=true" ng-init="paste=false" placeholder='please paste here'>
pasted: {{paste}}
Full code for this example as below:
<html>
<head>
<title>Angular JS Directive</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script>
angular.module('MyForm', [])
.controller('myController', ['$scope', function ($scope) {
}]);
</script>
</head>
<body ng-app="MyForm">
<div ng-controller="myController">
<p>How to use ng-paste and ng-cut?</p>
<h3>ng-cut is specify custom behavior on cut event.</h3>
<p>How to apply ng-cut</p>
<input ng-cut="cut=true" ng-init="cut=false; value='please cut me'" ng-model="value">
You just cut it: {{cut}}
<h3>ng-paste is specify custom behavior on paste event.</h3>
<p>How to apply ng-paste</p>
<input ng-paste="paste=true" ng-init="paste=false" placeholder='please paste here'>
pasted: {{paste}}
</div>
</body>
</html>
You can run by copy full code and run it on plunker
Thanks for your time reading.
No comments:
Post a Comment