From a39f8140ed464b880979c90774c82c4fa40d5da8 Mon Sep 17 00:00:00 2001 From: jn Date: Wed, 23 Jul 2014 18:21:37 -0600 Subject: [PATCH] Fixing autoselect based on comments @ https://github.com/angular-ui/bootstrap/issues/908#issuecomment-41289477 Fixing autoselect based on comments @ https://github.com/angular-ui/bootstrap/issues/908#issuecomment-41289477 --- src/typeahead/typeahead.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index f8babc7c56..0846e65226 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -125,6 +125,10 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap isLoadingSetter(originalScope, true); $q.when(parserResult.source(originalScope, locals)).then(function(matches) { + //Q&E FIX FOR AUTOSELECT based on https://github.com/angular-ui/bootstrap/issues/908#issuecomment-41289477 + matches.unshift(inputValue); + //END OF: Q&E FIX FOR AUTOSELECT + //it might happen that several async queries were in progress if a user were typing fast //but we are interested only in responses that correspond to the current view value var onCurrentRequest = (inputValue === modelCtrl.$viewValue);