Tuesday, January 30, 2018

How to write a program for a mouse over element in angularJS.

  • Mouse events occur when the cursor moves over an element, in this order:

  1. ng-mouseenter
  2. ng-mouseover
  3. ng-mousemove
  4. ng-mouseleave
Program
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body>
<div ng-app="abc" ng-controller="def">
<h1 ng-mousemove="count=count+1">
mouse over me
</h1>
<h2>
{{count}}
</h2>
</div>
<script>
var app=angular.module("abc",[]);
app.controller("def",function($scope) 
{
$scope.count=0;
});
</script>
</body>
</html>

Output




0 comments:

Post a Comment

Thanks For Commented.

TechTalk