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

Commit

Permalink
fix(typeahead): reset matches if enter is hit
Browse files Browse the repository at this point in the history
- If no match is selected and enter is hit, reset matches

Closes #4063
Fixes #3545
  • Loading branch information
wesleycho committed Aug 1, 2015
1 parent 7af9cdf commit 2570483
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
return;
}

// if there's nothing selected (i.e. focusFirst) and enter is hit, don't do anything
if (scope.activeIdx === -1 && evt.which === 13) {
return;
}

// if there's nothing selected (i.e. focusFirst) and tab is hit, clear the results
if (scope.activeIdx === -1 && evt.which === 9) {
// if there's nothing selected (i.e. focusFirst) and enter or tab is hit, clear the results
if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13)) {
resetMatches();
scope.$digest();
return;
Expand Down

0 comments on commit 2570483

Please sign in to comment.