 	transclude: true
 	restrict: "E"
 	compile: (element, attributes) ->
+		needHide = false
 		# $el used to be called $input but:
 		# http://walpurgisriot.github.io/blog/2013/12/16/the-worst-thing-about-coffeescript
 		$el = element.find "input"

			$input = element.find "input"

			# we don't use ng-blur to make sure typeahead can have a custom ng-blur too
			$input[0].addEventListener "blur", -> hideList()

			$timeout ->
				$ul = element.find "ul"

				currentEl.className += " active" if currentEl
				null
			select = (el) ->
				if el.tagName is "LI"
					text = angular.element(el).text()
					$timeout ->
						$input.val(text).triggerHandler("input")
						hideList()
				null
			scope.typeaheadKeydown = (evt) ->
				switch evt.which
