本篇内容主要讲解“常用angular事件的实例操作”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“常用angular事件的实例操作”吧!
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src='js/angular.min.js'> </script> <style type="text/css"> .ng-cloak{display:none;} </style> </head> <body ng-app="hd" ng-cloak class="ng-cloak"> <div ng-controller="ctrl"> <input type="button" value="单击" ng-click='run()'/>`num`<br /> <input type="button" value="双击" ng-dblclick="dblrun()"/>`dblnum`<br /> <!--ng-change需要绑定ng-model --> 数据更改:<input type="text" ng-change="changerun()" ng-model="title"/>`cnum`<br /> 失去焦点:<input type="text" ng-blur="blurun()"/>`bnum`<br /> 获取焦点:<input type="text" ng-focus="focusrun()"/>`fnum`<br /> 按下键盘:<input type="text" ng-keydown="keydown()"/>`knum`<br /> 抬起键盘:<input type="text" ng-keyup="keyup()"/>`kunum`<br /> 鼠标按下:<input type="text" ng-mousedown="mousedown()"/>`mdnum`<br /> 鼠标抬起:<input type="text" ng-mouseup="mouseup()"/>`munum`<br /> 鼠标进入: <input type="text" ng-mouseenter="mouseenter()"/>`menum`<br /> 鼠标离开: <input type="text" ng-mouseleave="mouseleave()"/>`mlnum`<br /> 鼠标移动:<input type="text" ng-mousemove="mousemove()"/>`mmnum`<br /> </div> <script type="text/javascript"> var m=angular.module('hd',[]) m.controller('ctrl',['$scope',function($scope){ $scope.num=0 //ng-click方法需要写进$scope中 $scope.run=function(){$scope.num++} $scope.dblnum=0 $scope.dblrun=function(){$scope.dblnum++} $scope.cnum=0 $scope.changerun=function(){$scope.cnum++} $scope.bnum=0 $scope.blurun=function(){$scope.bnum++} $scope.fnum=0 $scope.focusrun=function(){$scope.fnum++} $scope.knum=0 $scope.keydown=function(){$scope.knum++} $scope.kunum=0 $scope.keyup=function(){$scope.kunum++} $scope.mdnum=0 $scope.mousedown=function(){$scope.mdnum++} $scope.munum=0 $scope.mouseup=function(){$scope.munum++} $scope.menum=0 $scope.mouseenter=function(){$scope.menum++} $scope.mlnum=0 $scope.mouseleave=function(){$scope.mlnum++} $scope.mmnum=0 $scope.mousemove=function(){$scope.mmnum++} }]) </script> </body> </html>
到此,相信大家对“常用angular事件的实例操作”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。