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

add support for changing typeaheadMinLength #5363

Closed
wants to merge 3 commits into from

Conversation

germannj
Copy link
Contributor

One might want to change minLength no of characters condition based.
With the old implementation minLength is not changed when typeaheadMinLength is changed from outside, now with a watch it does change.

One might want to change minLength no of characters condition based.
@@ -38,7 +38,14 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
if (!minLength && minLength !== 0) {
minLength = 1;
}

originalScope.$watch(attrs.typeaheadMinLength, function (newVal) {
if (!newVal && newVal !== 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can just make a ternary, i.e.

minLength = !newVal && newVal !== 0 ? 1 : newVal;

@wesleycho
Copy link
Contributor

This needs tests and a docs update.

@germannj
Copy link
Contributor Author

germannj commented Feb 3, 2016

Test was added.
I think the documentation is already ok.

typeahead-min-length $ (Default: 1) - Minimal no of characters that needs to be entered before typeahead kicks-in. Must be greater than or equal to 0.

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.

2 participants