html代码:
<body>
<div ng-app="ngcopyApp" ng-controller="ngcopyCtrl">
<h2>AngularJS ng-copy,paste,cut事件示例</h2>
复制文本: <input type="text" ng-copy="copytext=true" value="Hi, Welcome to Tutlane" /> <br />
<span>操作状态:<b>{{copytext}}</b></span><br />
剪切文本: <input type="text" ng-cut="cuttext=true" value="Hi, Welcome to Tutlane" /> <br />
<span>操作状态:<b>{{cuttext}}</b></span><br />
粘贴文本: <input type="text" ng-paste="pasttext=true" /> <br />
<span>操作状态:<b>{{pasttext}}</b></span>
</div>
</body>
JavaScript代码:
<script type="text/javascript">
var app = angular.module('ngcopyApp', []);
app.controller('ngcopyCtrl', function ($scope) {
$scope.cuttext = false;
$scope.copytext = false;
$scope.pasttext = false;
});
</script>