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

feat(typeahead): handles min-length of 0 #3600

Closed

Conversation

zacronos
Copy link
Contributor

Correctly handles min-length of 0 (i.e. will 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).

@@ -41,7 +41,10 @@ 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) || 1;
var minSearch = originalScope.$eval(attrs.typeaheadMinLength);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe renaming to minLength would make it easier to read - similar to the attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitriz, I could change that if it is demanded, however note that I did not change that variable name -- minSearch was the name used in the original code.

Cleaning up pre-existing issues in the original code seems a rather high burden to place on a 5-line PR (not counting specs) from 1.5 years ago (this is a re-PR, the original was posted in Jan of 2014).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it was used only used in 2 places, now would be 5.
Would clean up a bit but no worries.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that one community members' notes and reviews aren't 'demands' on how you should do things but rather suggestions/tips. There should always be an open discussion 👍


This email was sent from my iPhone and therefore subject to typos and other inaccuracies.

On 30 apr. 2015, at 02:02, Joe Ibershoff [email protected] wrote:

In src/typeahead/typeahead.js:

@@ -41,7 +41,10 @@ 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) || 1;
    
  •  var minSearch = originalScope.$eval(attrs.typeaheadMinLength);
    
    @dmitriz, I could change that if it is demanded, however note that I did not change that variable name -- minSearch was the name used in the original code.

Cleaning up pre-existing issues in the original code seems a rather high burden to place on a 5-line PR (not counting specs) from 1.5 years ago (this is a re-PR, the original was posted in Jan of 2014).


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitriz, fair enough, you're right that this variable isn't really getting used elsewhere. I'll add that in.

@mattvague
Copy link

What's the status on this?

@chrisirhc
Copy link
Contributor

LGTM

@chrisirhc chrisirhc modified the milestones: 0.13.1 (Performance), 0.13.x Jun 8, 2015
@wesleycho wesleycho closed this in a5a2514 Jun 11, 2015
AParks added a commit to AParks/bootstrap-bower that referenced this pull request Aug 2, 2017
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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants