AngularJS Basic ng mouseenter Instruction Sample Code

  • 2021-07-07 06:18:33
  • OfStack

AngularJS ng-mouseenter Directive

AngularJS instance

Executes the expression when the mouse pointer crosses the 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-mouseenter="count = count + 1" ng-init="count=0"> Mouse through me !</div>

<h1>{{count}}</h1>

<p>
 This instance runs through the mouse  DIV  Element, the variable is evaluated  "count"  Will automatically add  1 . </p>

</body>
</html>

Definition and usage

The ng-mouseenter instructions are used to tell AngularJS what the mouse should do when an HTML element passes through.

The ng-mouseenter instruction does not override the element's native onmouseenter event, and when the event is triggered, both the ng-mouseenter expression and the native onmouseenter event are executed.

Grammar

< element ng-mouseenter="expression" > < /element >

All HTML elements support this instruction.

Parameter value

描述
expression 鼠标穿过元素时执行的表达式。

The above is the basic data collation of AngularJS ng-mouseenter instruction, and the relevant data will be supplemented in the future.


Related articles: