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

fix(typeahead): return null if empty #4078

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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