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

Feature: Ability to use angular service instead of URL #1

Open
leff opened this issue Aug 5, 2015 · 2 comments
Open

Feature: Ability to use angular service instead of URL #1

leff opened this issue Aug 5, 2015 · 2 comments
Labels

Comments

@leff
Copy link

leff commented Aug 5, 2015

This is a really nice library, and being able to just pass in a URL is quick and easy. But for some searches it's really useful to use an angular service to wrap the API call.

For example, in my particular environment I know that it will improve perceived performance to cache the API results locally after the first 2-3 characters, then filter the results in the client.

I don't want to prescribe how to make this work, but conceptually I'd be passing in a "searchFunction" instead of "url." The searchFunction would be asynchronous and return a promise. In the above example, my options would look like { searchFunction: MyAngularService.mySearchFunction }

Is this making sense? Is it doable?

@raeef-refai
Copy link
Contributor

I understood that you would add $watch on npInputModel where you will do the service logic which will resolve the promise passed to the searchFunction, if that's right then yes, it make sense, but I think instead of $watch we should add another option like onInputChange and give me sometime to add it or you are welcome to contribute.

@manishoo
Copy link

manishoo commented Jan 2, 2017

@raeef-refai thanks for the great library but are you ever gonna add the onInputChange ?

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

No branches or pull requests

3 participants