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

Typeahead show loading #192

Closed
kloy opened this issue Mar 5, 2013 · 6 comments
Closed

Typeahead show loading #192

kloy opened this issue Mar 5, 2013 · 6 comments

Comments

@kloy
Copy link

kloy commented Mar 5, 2013

@pkozlowski-opensource I am probably just missing how to do this, but from what I can tell you can not detect if a promise is still loading from within in the directive?

The only way I have come up with doing this thus far is to add an attribute to the input like typeahead-loading="value" and modify typeaheadPopup template and scope to see the value.

Is there a better way of doing this?

@kloy
Copy link
Author

kloy commented Mar 6, 2013

I found a better way of doing this, but it required a small change to the typeahead plugin. I will make a pull request when I am at home and have a bit of time.

@ajoslin
Copy link
Contributor

ajoslin commented Mar 6, 2013

I would add a variable in the directive scope when the typeahead value is an unresolved promise, and then add a loading spinner to the template based on that scope variable.

@kloy
Copy link
Author

kloy commented Mar 7, 2013

@ajoslin That is basically what I did. I added scope.loading = true and then set scope.loading = false when the promise was resolved in getMatchesAsync(). I also had to setup the scope on the directive typeaheadPopup so that I could use the parent scope's loading.

@pkozlowski-opensource
Copy link
Member

@kloy Pull request for this would be awesome

@kloy
Copy link
Author

kloy commented Mar 8, 2013

@pkozlowski-opensource I am having problems getting the angular-ui tests to run, and don't have time at the moment to get it working. Here is a working example of the code http://plnkr.co/edit/pbHtXnzGc7biWxuawAYD

Here is the commit on my fork kloy@827f263

@ajoslin
Copy link
Contributor

ajoslin commented May 22, 2013

Fixed via b58c9c8

@ajoslin ajoslin closed this as completed May 22, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants