angularjs ng-mouseenter directive

angularjs example

Execute the expression when the mouse pointer passes over the element:

<! Doctype html>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<body ng-app="">
<div ng-mouseenter="count=count + 1" ng-init="count=0">mouse over me!</div>
This example automatically increments the count variable "count" when the mouse is over the div element.</p>

Definition and usage

The ng-mouseenter directive is used to tell the angularjs mouse what to do when the html element passes through.

The ng-mouseenter directive does not override the element's native onmouseenter event. When the event is triggered,Both the ng-mouseenter expression and the native onmouseenter event will be executed.


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

All html elements support this directive.

Parameter value

value description
expression An expression that is executed when the mouse passes over the element.

  • Previous RecyclerView click item setting event in Android
  • Next Solution to the conflict between ThinkPHP and UCenter