I am struggling to get a function to trigger when my button is hovered over. Despite writing what I believe is the correct code, the function from my controller is not being called. Can anyone spot the issue?
Below is the JavaScript code:
angular.module("myApp", [])
.controller('myCtrl', function($scope) {
$scope.alertHi = function() {
alert('hi');
};
});
And here is the HTML code:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example72-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
</head>
<body ng-app="myApp">
<div ng-controller="myCtrl">
<button ng-mouseover="alertHi()">
Alert Hi
</button>
</div>
</body>
</html>
If you'd like to see the code in action, feel free to check out this live plunker:
http://plnkr.co/edit/ZyQUi266hFsnvPhcTcpn?p=preview
Any insights on why the function isn't firing would be greatly appreciated. Thank you!