Skip to content
Merged
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
feat(typeahead): handles min-length of 0
keep typeahead popup open even when all input has been deleted. Still uses a default value of 1 for backward compatibility (when min-length is falsy but not === 0).

see [#3600](angular-ui/bootstrap#3600) and [commit](angular-ui/bootstrap@a5a2514)
  • Loading branch information
AParks committed Aug 2, 2017
commit 64306dab35fb62fbb28b3c04f6229356f102b0bb
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"ignore": [],
"description": "Native AngularJS (Angular) directives for Bootstrap.",
"version": "0.12.1-7",
"version": "0.12.1-8",
"main": ["./ui-bootstrap-tpls.js"],
"dependencies": {
"angular": ">=1 <1.3.0"
Expand Down
10 changes: 5 additions & 5 deletions ui-bootstrap-tpls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3555,9 +3555,9 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
//SUPPORTED ATTRIBUTES (OPTIONS)

//minimal no of characters that needs to be entered before typeahead kicks-in
var minSearch = originalScope.$eval(attrs.typeaheadMinLength);
if (!minSearch && minSearch !== 0) {
minSearch = 1;
var minLength = originalScope.$eval(attrs.typeaheadMinLength);
if (!minLength && minLength !== 0) {
minLength = 1;
}

//minimal wait time after last character typed before typehead kicks-in
Expand Down Expand Up @@ -3710,7 +3710,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap

hasFocus = true;

if (inputValue && inputValue.length >= minSearch) {
if (minLength === 0 || inputValue && inputValue.length >= minLength) {
if (waitTime > 0) {
cancelPreviousTimeout();
scheduleSearchWithTimeout(inputValue);
Expand Down Expand Up @@ -3825,7 +3825,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap

element.bind('focus', function (evt) {
hasFocus = true;
if (minSearch === 0 && !modelCtrl.$viewValue) {
if (minLength === 0 && !modelCtrl.$viewValue) {
$timeout(function() {
getMatchesAsync(modelCtrl.$viewValue, evt);
}, 0);
Expand Down
10 changes: 5 additions & 5 deletions ui-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3554,9 +3554,9 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
//SUPPORTED ATTRIBUTES (OPTIONS)

//minimal no of characters that needs to be entered before typeahead kicks-in
var minSearch = originalScope.$eval(attrs.typeaheadMinLength);
if (!minSearch && minSearch !== 0) {
minSearch = 1;
var minLength = originalScope.$eval(attrs.typeaheadMinLength);
if (!minLength && minLength !== 0) {
minLength = 1;
}

//minimal wait time after last character typed before typehead kicks-in
Expand Down Expand Up @@ -3709,7 +3709,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap

hasFocus = true;

if (inputValue && inputValue.length >= minSearch) {
if (minLength === 0 || inputValue && inputValue.length >= minLength) {
if (waitTime > 0) {
cancelPreviousTimeout();
scheduleSearchWithTimeout(inputValue);
Expand Down Expand Up @@ -3824,7 +3824,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap

element.bind('focus', function (evt) {
hasFocus = true;
if (minSearch === 0 && !modelCtrl.$viewValue) {
if (minLength === 0 && !modelCtrl.$viewValue) {
$timeout(function() {
getMatchesAsync(modelCtrl.$viewValue, evt);
}, 0);
Expand Down