AngularJS Infinite Scrolling with lots of data

后端 未结 6 826
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 01:05

So I\'m trying to create an infinite scrolling table using AngularJS, similar to this: http://jsfiddle.net/vojtajina/U7Bz9/

The problem I\'m having is that in the jsfidd

6条回答
  •  执念已碎
    2021-01-30 01:20

    I like the angular-ui implementation ui-scroll...

    https://github.com/angular-ui/ui-scroll

    ... over ngInfiniteScroll. The main difference with ui-scroll from a standard infinite scroll is that previous elements are removed when leaving the viewport.

    From their readme...

    The common way to present to the user a list of data elements of undefined length is to start with a small portion at the top of the list - just enough to fill the space on the page. Additional rows are appended to the bottom of the list as the user scrolls down the list.

    The problem with this approach is that even though rows at the top of the list become invisible as they scroll out of the view, they are still a part of the page and still consume resources. As the user scrolls down the list grows and the web app slows down.

    This becomes a real problem if the html representing a row has event handlers and/or angular watchers attached. A web app of an average complexity can easily introduce 20 watchers per row. Which for a list of 100 rows gives you total of 2000 watchers and a sluggish app.

    Additionally, ui-scroll is actively maintained.

提交回复
热议问题