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

Commit

Permalink
fix(typeahead): add guard for no $viewValue
Browse files Browse the repository at this point in the history
- Add guard when $viewValue is undefined, and when showHint & min-length
  0 is used

Closes #5358
Fixes #5357
  • Loading branch information
wesleycho committed Jan 28, 2016
1 parent d2621e3 commit dbe9e81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/typeahead/typeahead.js
Expand Up @@ -247,10 +247,11 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap

if (showHint) {
var firstLabel = scope.matches[0].label;
if (inputValue.length > 0 && firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {
if (angular.isString(inputValue) &&
inputValue.length > 0 &&
firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {
hintInputElem.val(inputValue + firstLabel.slice(inputValue.length));
}
else {
} else {
hintInputElem.val('');
}
}
Expand Down

0 comments on commit dbe9e81

Please sign in to comment.