creating a new directive with angularjs
问题 so i'm making a simple directive called "hover", it's a basic nav menu that when you pass a mouse over a specific aba, this aba changes the color. See my script code: var app = angular.module('myModule', []); app.directive('hover', function(){ return{ restrict: 'E', controller: function($scope) { $scope.hover = null; $scope.selected = null; $scope.onHover = function (index){ $scope.hover = index; } $scope.mouseLeave = function(){ if($scope.selected) $scope.hover = $scope.selected; else $scope