AngularJS ng-mouseleave directive

Definition and Usage

ng-mouseleave tells AngularJS what operation to perform when the mouse cursor leaves a specific HTML element.

The directive of AngularJS ng-mouseleave The directive does not override the original onmouseleave event of the element, and both will be executed.

Example

Execute the expression when the mouse cursor leaves the <div> element:

<div ng-mouseleave="count = count + 1" ng-init="count=0">Place the mouse above me! (Then move the mouse away...)</div>
<h1>{{count}}</h1>

Try It Yourself

Syntax

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

All HTML elements support it.

Parameters

Parameters Description
expression The expression to be executed when the mouse cursor leaves the element.