AngularJS基础 ng-mouseover 指令简单示例
AngularJSng-mouseover指令
AngularJS实例
在鼠标指针移动到元素上时执行表达式:
<!DOCTYPEhtml> <html> <head> <metacharset="utf-8"> <scriptsrc="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <bodyng-app=""> <divng-mouseover="count=count+1"ng-init="count=0">鼠标移动到我这!</div> <h1>{{count}}</h1> <p>该实例在鼠标移动到DIV元素时,计算变量"count"会自动加1。</p> </body> </html>
定义和用法
ng-mouseover指令用于告诉AngularJS鼠标移动到指定的HTML元素上时要执行的操作。
ng-mouseover指令不会覆盖元素的原生onmouseover事件,事件触发时,ng-mouseover表达式与原生的onmouseover事件将都会执行。
语法
<elementng-mouseover="expression"></element>
所有的HTML元素支持该指令。
参数值
值
描述
expression
鼠标移动到元素上时执行的表达式。
以上就是对AngularJSng-mouseover指令的资料整理,后续继续补充,谢谢大家支持!