AngularJS基础 ng-mouseenter 指令示例代码
AngularJSng-mouseenter指令
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-mouseenter="count=count+1"ng-init="count=0">鼠标穿过我!</div> <h1>{{count}}</h1> <p> 该实例在鼠标穿过DIV元素时,计算变量"count"会自动加1。</p> </body> </html>
定义和用法
ng-mouseenter指令用于告诉AngularJS鼠标在HTML元素穿过时要执行的操作。
ng-mouseenter指令不会覆盖元素的原生onmouseenter事件,事件触发时,ng-mouseenter表达式与原生的onmouseenter事件将都会执行。
语法
<elementng-mouseenter="expression"></element>
所有的HTML元素支持该指令。
参数值
值
描述
expression
鼠标穿过元素时执行的表达式。
以上就是对AngularJSng-mouseenter指令的基础资料整理,后续继续补充相关资料。