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

Commit

Permalink
fix(typeahead): return null if empty
Browse files Browse the repository at this point in the history
- Return `null` instead to unify falsy values

Closes #4078
Fixes #3176
  • Loading branch information
wesleycho committed Aug 2, 2015
1 parent cf65a63 commit c7d3a66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/typeahead/test/typeahead.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe('typeahead tests', function () {
expect($scope.result).toEqual(undefined);
expect($scope.form.input.$error.editable).toBeTruthy();
changeInputValueTo(element, '');
expect($scope.result).toEqual('');
expect($scope.result).toEqual(null);
expect($scope.form.input.$error.editable).toBeFalsy();
});

Expand Down
2 changes: 1 addition & 1 deletion src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
if (!inputValue) {
// Reset in case user had typed something previously.
modelCtrl.$setValidity('editable', true);
return inputValue;
return null;
} else {
modelCtrl.$setValidity('editable', false);
return undefined;
Expand Down

0 comments on commit c7d3a66

Please sign in to comment.