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

How can a get a "selected" event when a suggested item is selected from list? #27

Closed
ghost opened this issue May 13, 2014 · 10 comments
Closed

Comments

@ghost
Copy link

ghost commented May 13, 2014

No description provided.

@davidmh
Copy link
Collaborator

davidmh commented May 13, 2014

Can you elaborate?

@ghost
Copy link
Author

ghost commented May 13, 2014

Yes, thank you! I want to use $http to fetch a list of results based on a few form fields.

For simplicity, let's say we want to search for friends:

Home town _____________ (uses allmighty-autocomplete)
First name _________
Gender M/F

I want this form to update results when anything is changed -- but not with every on-type event in the hometown field -- only when a real city is selected from the list of autocomplete suggestions.

Any way to do this?

@davidmh
Copy link
Collaborator

davidmh commented May 13, 2014

That functionality it's not implemented yet, but it could be easily incorporated.

You could add a callback around here.

@ghost
Copy link
Author

ghost commented May 13, 2014

Thanks so much for the response — I’ll see what I can do. Meanwhile perhaps you can consider this an official “feature request” :-)

Thanks!

On May 13, 2014, at 4:47 PM, Chuck notifications@github.com wrote:

That functionality it's not implemented yet, but it could be easily incorporated.

You could add a callback around here.


Reply to this email directly or view it on GitHub.

@ghost
Copy link
Author

ghost commented May 14, 2014

Would you be so kind as to point me a bit further in the right direction? I tried calling my controller method directly from the point in the code where you showed me -- bit the method can't be found. I suspect it's out of scope but not sure how to address it properly. I'm simply trying to run a method named "updateProviders()" which is in my formCtrl controller. Any tips for an NG newbie? Thanks :-)

@davidmh
Copy link
Collaborator

davidmh commented May 14, 2014

You're right, the function it's out of the scope, you need to make a connection between your app's scope and this directive.

You can add a new attribute to specify the function to be referenced, and the invoking it where you need it.

You can see that exact example with the on-type parameter in the directive attributes.

Declaration for the scope and invokation

@davidmh
Copy link
Collaborator

davidmh commented May 16, 2014

Hey @df-sean, what did you end up using?

If you haven't done it yet, I could give it a shot.

@ghost
Copy link
Author

ghost commented May 16, 2014

Thank you so much for following up. A few hours ago, I followed your example and managed to get it going. Thanks again!

@davidmh
Copy link
Collaborator

davidmh commented May 16, 2014

Cool, you should send a pull request, it would be really useful to have that functionality.

@ghost
Copy link
Author

ghost commented May 16, 2014

Pull request issued — cheers!

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

No branches or pull requests

1 participant