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

Commit c7d3a66

Browse files
committed
fix(typeahead): return null if empty
- Return `null` instead to unify falsy values Closes #4078 Fixes #3176
1 parent cf65a63 commit c7d3a66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/typeahead/test/typeahead.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe('typeahead tests', function () {
258258
expect($scope.result).toEqual(undefined);
259259
expect($scope.form.input.$error.editable).toBeTruthy();
260260
changeInputValueTo(element, '');
261-
expect($scope.result).toEqual('');
261+
expect($scope.result).toEqual(null);
262262
expect($scope.form.input.$error.editable).toBeFalsy();
263263
});
264264

src/typeahead/typeahead.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
290290
if (!inputValue) {
291291
// Reset in case user had typed something previously.
292292
modelCtrl.$setValidity('editable', true);
293-
return inputValue;
293+
return null;
294294
} else {
295295
modelCtrl.$setValidity('editable', false);
296296
return undefined;

0 commit comments

Comments
 (0)