How to retain scroll position of ng-repeat in AngularJS?

前端 未结 9 1456
梦谈多话
梦谈多话 2020-12-05 00:47

DEMO

List of objects is rendered using ng-repeat. Suppose that this list is very long and user is scrolling to the bottom to see some objects.

W

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 01:17

    There are, I believe, only a few possible solutions

    1) Don't add the item (as per the other answer)

    2) Add the item at bottom, so the list doesn't move.

    3) Add the item at top and scroll the screen automatically so that the new item's height is accounted for, and everything is kept seemingly as before. The list will move down, but the viewable screen itself will also move - so relatively nothing will be seen to move. Well other elements that are not part of list will, but that might actually look quite nice...

提交回复
热议问题