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

Reinitialize Typeahead with new source #27

Closed
redskins80 opened this issue Mar 17, 2014 · 3 comments
Closed

Reinitialize Typeahead with new source #27

redskins80 opened this issue Mar 17, 2014 · 3 comments

Comments

@redskins80
Copy link

Firstly, many thanks for this angular method of using typeahead!

My use case has brought me to a grinding halt. Ill try to describe it as best i can..

Essentially, I have two 'sources' from which I want typeahead to suggest from. I am using the bloodhound engine. So, I have initialized two Bloodhound objects - one, numbers.initialize() and two, letters.initialize(). Problem is, when I intiialized typeahead at fist using source:numbers.ttAdapter() it obviously works as expected.. But, on selection of an item from typeahead, I want to change the source to source:letter.ttAdapter(), since according to my use case, I want another source to be used for suggestion. What could be the best way to do that? Any way to reinitialize typeahead programatically with a new source?

@Siyfion
Copy link
Owner

Siyfion commented Mar 18, 2014

Sorry, I'm struggling to understand your use-case in this scenario.

You can attach more than one Bloodhound object to a single typeahead control on initialisation. However, you are saying that you wish to switch suggestion engines half-way through the typeahead receiving input?

Can you provide an example of why you'd need this functionality, over say, two separate typeahead controls, or a single bloodhound object with all combinations of both numbers and letters, or a simple text input with a Regex validation?

@redskins80
Copy link
Author

I have two bloodhound objects... And yes.. I wish to switch objects half
way.. I'm trying to implement a kind of search where different backends are
queried depending on the suggestion selected before. In my use case, a
previous suggestion selected has some semantic meaning and cannot be
clubbed with another set of suggestions as you suggest. Based on the
previous suggestion selected, another backend is queried and I want the
suggestions of that to be isolated and shown with the type ahead.

I hope you understand my case.
I have already figured out a hacky way to make this work... Basically, i
created another isolation scope in the directive and sent the
numbers.ttAdapter from the controller to the directive. But I was wondering
if there could be a nicer method that could perform this.
On 18 Mar 2014 17:15, "Simon Mansfield" notifications@github.com wrote:

Sorry, I'm struggling to understand your use-case in this scenario.

You can attach more than one Bloodhound object to a single typeahead
control on initialisation. However, you are saying that you wish to switch
suggestion engines half-way through the typeahead receiving input?

Can you provide an example of why you'd need this functionality, over say,
two separate typeahead controls, or a single bloodhound object with all
combinations of both numbers and letters, or a simple text input with a
Regex validation?

Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-37923664
.

@Siyfion
Copy link
Owner

Siyfion commented Mar 18, 2014

I'm afraid that this isn't a use-case that I can easily support, as Twitter Typeahead simply isn't designed to be used in this way.

@Siyfion Siyfion closed this as completed Mar 18, 2014
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