Angularjs真是个好东西

时间:2023-03-09 13:01:40
Angularjs真是个好东西

事件篇:

实例:(点击按钮内容加1)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">

<p>点击按钮:</p>

<button ng-click="count = count + 1" ng-init="count=0">OK</button>

<p>按钮被点击了 {{count}} 次。</p>

<p>实例中,按钮每被点击一次变量 "count" 会自动加 1。</p>

</body>
</html>

API:

AngularJS 事件

AngularJS 支持以下事件:

  • ng-click
  • ng-dbl-click
  • ng-mousedown
  • ng-mouseenter
  • ng-mouseleave
  • ng-mousemove
  • ng-keydown
  • ng-keyup
  • ng-keypress
  • ng-change