AngularJS Basic ng mouseover Simple Example
- 2021-07-07 06:12:38
- OfStack
AngularJS ng-mouseover Directive
AngularJS instance
Executes an expression when the mouse pointer moves over an element:
<!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="">
<div ng-mouseover="count = count + 1" ng-init="count=0"> Move the mouse to me !</div>
<h1>{{count}}</h1>
<p> This instance moves the mouse to the DIV Element, the variable is evaluated "count" Will automatically add 1 . </p>
</body>
</html>
Definition and usage
The ng-mouseover directives are used to tell AngularJS what to do when the mouse moves over the specified HTML element.
The ng-mouseover instruction does not override the element's native onmouseover event, and when the event is triggered, both the ng-mouseover expression and the native onmouseover event are executed.
Grammar
<
element ng-mouseover="expression"
>
<
/element
>
All HTML elements support this instruction.
Parameter value
值 | 描述 |
---|---|
expression | 鼠标移动到元素上时执行的表达式。 |
The above is the data collation of AngularJS ng-mouseover instructions, and the follow-up will continue to be supplemented. Thank you for your support!