基本介绍
angular的事件指令都是ng-click,ng-blur....的形式,类似于js的事件
基本使用
<!DOCTYPE html> <html lang="en" ng-app="App"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="../libs/angular.min.js"></script> </head> <body> <div ng-controller="DemoController"> <button ng-click="single()">单机</button> <button ng-dblclick="double()">双机</button> </div> <script> var App = angular.module(‘App‘, []); App.controller(‘DemoController‘, [‘$scope‘, function ($scope) { $scope.single=function () { alert(‘单机‘); } $scope.double=function () { alert(‘双击‘); } }]); //ng-click //ng-dbclick //ng-blur //ng-mouseout //ng- </script> </body> </html>