- ng-change
- ng-click
- ng-dbclick
- ng-mousedown
- ng-mouseenter
- ng-mouseleave
- ng-mousemove
- mg-mouseover
- ng-mouseup
- ng-submit
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div ng-app="myApp"> <div ng-controller="firstController"> <button ng-click="changeStatus($event)">切换状态</button> {{status}} </div> </div> <script type="text/javascript" src="../../vendor/angular/angularjs.js"></script> <script type="text/javascript" src="app/index.js"></script> </body> </html>
var myApp = angular.module(‘myApp‘,[]) .controller(‘firstController‘,function ($scope) { $scope.status = ‘false‘; // $scope.changeStatus = function () { // $scope.status = !$scope.status; // } $scope.changeStatus = function (event) { //通过 element 转换成 jquery 对象 angular.element(event.target).html(‘转换状态为:‘ + $scope.status); $scope.status = !$scope.status; } });
时间: 2024-10-10 12:38:18