diff --git a/src/directives/autocomplete.coffee b/src/directives/autocomplete.coffee index bdb8802..eee97a6 100644 --- a/src/directives/autocomplete.coffee +++ b/src/directives/autocomplete.coffee @@ -29,6 +29,7 @@ A directive for providing suggestions while typing into the field ### angular.module("Mac").directive "macAutocomplete", [ + "$animate" "$http" "$filter" "$compile" @@ -36,7 +37,7 @@ angular.module("Mac").directive "macAutocomplete", [ "$parse" "$rootScope" "keys" - ($http, $filter, $compile, $timeout, $parse, $rootScope, keys) -> + ($animate, $http, $filter, $compile, $timeout, $parse, $rootScope, keys) -> restrict: "E" templateUrl: "template/autocomplete.html" replace: true @@ -59,7 +60,7 @@ angular.module("Mac").directive "macAutocomplete", [ timeoutId = null onSelectBool = false - $menuScope = $rootScope.$new() + $menuScope = $rootScope.$new(true) $menuScope.items = [] $menuScope.index = 0 @@ -76,8 +77,8 @@ angular.module("Mac").directive "macAutocomplete", [ # If value is more than an empty string, # autocomplete is enabled and not 'onSelect' cycle if value and not disabled($scope) and not onSelectBool + $timeout.cancel timeoutId if timeoutId? if delay > 0 - $timeout.cancel timeoutId if timeoutId? timeoutId = $timeout -> queryData value , delay @@ -217,9 +218,9 @@ angular.module("Mac").directive "macAutocomplete", [ # # @event - # @name resetAutocomplete + # @name reset-mac-autocomplete # @description # Event to reset autocomplete # - $scope.$on "resetAutocomplete", -> reset() + $scope.$on "reset-mac-autocomplete", -> reset() ]