                         a.sense.length - b.sense.length
                 deferred.resolve data
             return deferred.promise
+
+
+
+korpApp.directive "typeaheadClickOpen", ($parse, $timeout)->
+    dir =
+        restrict: "A"
+        require: "ngModel"
+        link: ($scope, elem, attrs)->
+            triggerFunc = (event)->
+                if event.keyCode is 40 and not $scope.typeaheadIsOpen
+                    ctrl = elem.controller 'ngModel'
+                    prev = ctrl.$modelValue || ''
+                    if prev
+                        ctrl.$setViewValue ''
+                        $timeout -> ctrl.$setViewValue "#{prev}"
+            elem.bind 'keyup', triggerFunc
 
 
 

                    typeahead-template-url="lemgramautocomplete.html"
                    typeahead-loading="isLoading"
                    typeahead-on-select="selectedItem($item, $model, $label)"
                    placeholder="{{placeholderToString(placeholder)}}"></div>
                <div style="margin-left:-20px;margin-top:2px;float:left" ng-if="isLoading"><i class="fa fa-spinner fa-pulse"></i></div>
            </div>
            <div ng-show="disableLemgramAutocomplete">

            </script>
            <div ng-show="!disableLemgramAutocomplete">
                <div style="float:left"><input
                    id="korpAutocompleteInput"
                    autofocus
                    type="text"
                    ng-model="textInField"
