tl;dr What's the optimal way to filter large lists in Angular?
This is mainly about performance.
I have an array of objects that I list with ng-repeat. There will be hundreds to thousands of items. I now need to filter the list based on either:
- A. a single, simple property (e.g. number)
- B. multiple conditions (some expression)
What option is best:
- use a custom filter
- use ng-show / ng-hide
- use ng-if
- don't filter in the view at all -- maybe use service + controller (?)
- use ReactJS (?)
Details about the usecase:
- I want to bind most of the objects' properties with :: one time binding, though some properties need two-way binding (score for sorting)
- The list will be sorted dynamically, on fields independent from the fields used for filtering. Items filtered out probably should not be included in the sorting
- The filtering needs to be dynamic
So I found Ben Nadel's post http://www.bennadel.com/blog/2487-filter-vs-nghide-with-ngrepeat-in-angularjs.htm but my question is meant to address general, standard usecases.
Aucun commentaire:
Enregistrer un commentaire