 					null
 				select = (el) ->
 					$input.val(el.innerHTML).triggerHandler("input")
-					$lis.addClass "hide"
+					$lis.removeClass("show").removeClass("active").addClass "hide"
+					null
 				scope.typeaheadKeydown = (evt) ->
 					switch evt.which
 						when 38 # top


	res =
		template: """
		<div ng-keydown="typeaheadKeydown($event)" ng-keyup="typeaheadKeyup()"><input ng-model="term" type="text" autocomplete="off" /><div ng-click="typeaheadSelect($event)"><div ng-transclude></div></div></div>
		"""
		scope: true
		transclude: true

					# if the declaration is something like <typeahead ng-model="something">...
					term = $input.val().toLowerCase()
					for liEl in $lis
						liEl.className = if term and liEl.innerHTML.toLowerCase().indexOf(term) >= 0 then "show" else "hide"
					null
	res
]