 	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"

				currentEl.className += " active" if currentEl
				null
			select = (el) ->
				$timeout ->
					$input.val(el.innerHTML).triggerHandler("input")
					hideList()
				null
			scope.typeaheadKeydown = (evt) ->
				switch evt.which

						currentEl.className = "show" if currentEl
						currentEl = null
				null
			scope.typeaheadSelect = (evt) ->
				needHide = false
				select evt.target
			scope.typeaheadKeyup =(evt) ->
				return if evt.which in [38, 40, 16, 32, 13, 27]
				# we don't use ng-model (scope.term) here, because it might have been overwritten
