md-virtual-repeater using body as container

雨燕双飞 提交于 2019-12-14 02:28:05

问题


I am planning to use Angular Material's virtual repeat to achieve a Facebook like functionality where posts infinitely scroll.

Is it possible to have the virtual repeat container on the body tag of the HTML document?

I don't see how that will work. I have different routes in my SPA app, I will need to add/remove the virtual repeat container on the body dynamically depending on if the page uses infinite scroll or not...

What's a viable strategy for implementing md-virtual-repeat for having the HTML body to be the scroll container?

I have not come across any examples which put the container on the body element.

Any help would be appreciated.


回答1:


After some fiddling around, I've found the answer.

The answer is actually very simple, if you're using Angular Material, stick to Angular Material.

I've used all the layouts (i.e. container, nav, sidenav), I've found that Angular Material does not use the browser's body to scroll anyway. All content is contained in their container element. Simply put a md-virtual-repeat-viewport on there and you are good to go!



来源:https://stackoverflow.com/questions/41175828/md-virtual-repeater-using-body-as-container

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