Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeahead onSelect callback #606

Closed
AlexKhymenko opened this issue Aug 17, 2016 · 9 comments
Closed

Typeahead onSelect callback #606

AlexKhymenko opened this issue Aug 17, 2016 · 9 comments

Comments

@AlexKhymenko
Copy link

Is it possible to add typeaheadOnselect callback?

@pkozlowski-opensource
Copy link
Member

Sure, this would be trivial to implement (wouldn't expect it to be more than 5 LOC). But I thought that it is not needed since we can use the ngModelChange event to know where the model gets changed.

@AlexKhymenko as stated above this would be very easy to do but I don't want to duplicate the existing functionality. So could you tell us more about your use case and evaluate if ngModelChange wouldn't be enough?

@AlexKhymenko
Copy link
Author

AlexKhymenko commented Aug 18, 2016

The problem comes ngModelChange fires on every user input. So when user pust 'al' it fill fire ngModelChange on every letter 'a' then 'l' before I even select Alabama.
The use case that i'm facing is when user selects for example Alabama he should go to Alabama page.
So the functionality that will be good to have is to have a callback when user selects something.

@pkozlowski-opensource
Copy link
Member

Oh right! I was kind of assuming "no edit" mode, sorry for the noise. We should add this for the next alpha.

@pkozlowski-opensource pkozlowski-opensource added this to the alpha.3 milestone Aug 18, 2016
@AlexKhymenko
Copy link
Author

Thank YOU! Very much!

@AlexKhymenko
Copy link
Author

AlexKhymenko commented Aug 19, 2016

I'm not sure that its a good idea to name it ('select'), cause input has its own select event(but it does different thing) and it could lead to unforeseen consequences .

@pkozlowski-opensource
Copy link
Member

Grr, you are right @AlexKhymenko ! How about itemSelect or selectItem? Any other suggestions?

@AlexKhymenko
Copy link
Author

selectItem is the best choice(to my mind). Another one is typeaheadOnSelect(but this one is not good with naming style you use across the whole app).

@pkozlowski-opensource
Copy link
Member

@AlexKhymenko thnx. Here is the PR: #612

@AlexKhymenko
Copy link
Author

@pkozlowski-opensource Thank You!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants