Typeahead: delay ajax requests
Hi,
This is more of a question than an issue as this project doesn't seem to have an IRC chat room.
I currently set a min-length of 1. However after that, if I were to type 5 more letters, it fires 5 ajax requests. I only want it to fire the ajax requests after a specified 1-2 seconds. Is such a feature possible? I know there's a delay feature, but the docs aren't really clear.
If a number is supplied, delay is applied to both hide/show
Is this a UI thing or is it really delaying the ajax requests?
I realized that minLength doesn't seem to work either. I am using Typeahead with an async data provider. Does that have anything to do with neither minLength nor delay having any effect?
I am experiencing the same issue at the moment. Both minLength and delay properties seem to be ignored.
I believe the delay is just to delay the animation, not delay the actual firing of the request. I've manually tweaked my download of angular-strap to debounce the request, as per the details here: https://github.com/mgcrea/angular-strap/pull/696
You are absolutely correct, the delay is just for animation not the actual firing of the request. I find that really weird. It's as if the creators of this directive misunderstood the meaning of delay.
On Tue, Aug 5, 2014 at 5:33 PM, M21B8 [email protected] wrote:
I believe the delay is just to delay the animation, not delay the actual firing of the request. I've manually tweaked my download of angular-strap to debounce the request, as per the details here: #696 https://github.com/mgcrea/angular-strap/pull/696
— Reply to this email directly or view it on GitHub https://github.com/mgcrea/angular-strap/issues/749#issuecomment-51174179 .
I think it's just a slightly mis-clear labelling, should probably be called 'animation-delay'
I am also having the issue where promises are still called even if the minLength has not been met
I have the same issue, but I suppose this is the same case as with the delay - the setting only affects visual elements, it doesn't affect async calls in the background.
yes same issue here. +1 to fix the problem
@mgcrea was there ever a PR for this? Yes you can use ngModelOptions on a per typeahead instance basis, but a global debounce for all typeaheads (via typeaheadProvider) would be really nice too!
ngModelOptions doesn't serve the purpose, let's say I set the debounce in ngModelOptions to 300 ms, and I type 'test'... then 350 ms pause and 'ing'... what happens is two requests would be sent to server, first with 'test' and second with 'testing'. Now let's say the server responds the first request with some delay so that the result of 2nd query comes first and 1st query comes last... what will be shown in the autocomplete result is a set, matched with 'test' query which is wrong. Makes sense?
@khashayar I was referencing this: https://github.com/mgcrea/angular-strap/pull/696
It would be nice to have this documented.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.