AngularJs ng-repeat with thousands of items [closed]

白昼怎懂夜的黑 提交于 2020-12-27 06:22:25

问题


We are trying to find a solution for displaying 10k checkboxes in the Umbraco back office that rendered with ng-repeat. We've realized that angularJs are not able to perform more than 2500 items in ng-repeat with data-binding.

I'm thinking about rendering parts of the array during the user scrolls the page, or it will be too much for ng-repeat as well?

Any recommendations?

Possible solutions:

  1. Paging
  2. Infinite scrolling - I would like to do it, but now sure what plugin to use

Thanks,

Alex


回答1:


Instead of using infinite scrolling, you can also use virtual scrolling (see difference here What are differences and use cases for Virtual VS Infinite scroll in Ionic 3). You can use virtual scrolling with angularJs, and you can find a library which uses it with ng-repeat angular-virtual-scroll.

Virtual scrolling ensures you only render (and keep on the DOM) elements the users sees, which means that most of the checkboxes out of the 10,000 you mentioned won't be visible. On top of that, I would also recommend using some sort of search or filter on the list of checkboxes, to make it easier for users to find what they are looking for.



来源:https://stackoverflow.com/questions/65251574/angularjs-ng-repeat-with-thousands-of-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!