fix(typeahead): fix programmatic focus issue
- Fix issue where programmatic focus on typeahead input does not work Closes #5150 Fixes #764
This commit is contained in:
@@ -1337,6 +1337,7 @@ describe('typeahead tests', function() {
|
||||
var element = prepareInputEl('<div><input ng-model="result" uib-typeahead="item for item in source | filter:$viewValue" typeahead-min-length="0"></div>');
|
||||
var inputEl = findInput(element);
|
||||
inputEl.focus();
|
||||
$timeout.flush();
|
||||
$scope.$digest();
|
||||
expect(element).toBeOpenWithActive(3, 0);
|
||||
});
|
||||
|
||||
@@ -407,7 +407,9 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
|
||||
element.bind('focus', function () {
|
||||
hasFocus = true;
|
||||
if (minLength === 0 && !modelCtrl.$viewValue) {
|
||||
getMatchesAsync(modelCtrl.$viewValue);
|
||||
$timeout(function() {
|
||||
getMatchesAsync(modelCtrl.$viewValue);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user