您好,登錄后才能下訂單哦!
本篇內容主要講解“常用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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。