简体   繁体   中英

Best way to implement auto suggestions feature?

Currently, we are manually making a request call for suggestion data with every keyup, but cancelling the previous call made before making the new one. Is there a better way to do this with Angular.js/Node.js, or perhaps some other library that we can simply import? Any suggestions would be appreciated.

One thing that you can do is to send requests only after some small time of not typing, instead of on every keyup.

So for example when someone quickly types 20 characters then right now you're making 20 requests and cancel most of them. But if you were sending a request only after for example half a second of non-typing then it would be just one request, with the same result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM