在用户名在AngularJS列表搜索用户 [英] Search a user in a list of usernames in AngularJS
问题描述
我要寻找的东西,一会可能是在数百个教程AngularJS中找到,但我不太知道去哪里找。
I am looking for something that one would probably find in hundreds of tutorials for AngularJS but I don't quite know where to look.
欲用于搜索由用户的名称的用户出的存储在数据库中数万列表的最佳做法。我正在考虑类似Facebook的好友搜索领域的东西。因此,随着用户开始输入应该出现提出的结果。
如果列表已经在客户端上,简单的 NG-过滤器
行为就足够了,但我不想转储一个JSON文件的整个数据库。
I want the best practice for searching a user by the user's name out of a list of ten thousands stored in the database. I am thinking about something similar to Facebook's "friend search" field. So as the user starts typing proposed results should appear.
If the list was already on the client, the simple ng-filter
behaviour would be enough, but I don't want to dump the whole database in a json file.
可能有人转发我一些提示如何处理这个问题,哪里有陷阱?后端是一个Symfony2的应用程序与原则,如果该事项...
Could somebody forward me some hints how to approach this problem and where the pitfalls are? The backend is a Symfony2 application with Doctrine, if that matters...
感谢您!
推荐答案
有关请求10000数据像组件组合,你应该使用typehead与异步调用。
For requesting ten thousand of data in a combo like component, you should use a typehead with an asynchronous call.
请参阅此组件:
https://github.com/angular-ui/bootstrap/树/主/ src目录/预输入
您索引的数据已经被编入索引(Lucene的或同等学历)具有可接受的性能。
Your indexed data have to be indexed (lucene or equivalent) to have acceptable performances.
这篇关于在用户名在AngularJS列表搜索用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!