Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit dbe9e81

Browse files
committed
fix(typeahead): add guard for no $viewValue
- Add guard when $viewValue is undefined, and when showHint & min-length 0 is used Closes #5358 Fixes #5357
1 parent d2621e3 commit dbe9e81

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/typeahead/typeahead.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
247247

248248
if (showHint) {
249249
var firstLabel = scope.matches[0].label;
250-
if (inputValue.length > 0 && firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {
250+
if (angular.isString(inputValue) &&
251+
inputValue.length > 0 &&
252+
firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {
251253
hintInputElem.val(inputValue + firstLabel.slice(inputValue.length));
252-
}
253-
else {
254+
} else {
254255
hintInputElem.val('');
255256
}
256257
}

0 commit comments

Comments
 (0)