Within my Angular application, I am utilizing the Virtual Scroll feature from the Angular cdk.
Here is a snippet of my Component's template:
<cdk-virtual-scroll-viewport itemSize="50" class="example-viewport">
<div *cdkVirtualFor="let item of items" class="example-item">{{item}}</div>
</cdk-virtual-scroll-viewport>
Within my Component's class, there exists a method that modifies the array items
by providing it with new content. The size of this array can vary each time the method is executed:
reload(newItems) {
this.items = newItems;
}
Upon calling the reload
function, the items array updates correctly and visually reflects all changes. However, the scroll position does not reset to the top.
I am looking for a way to automatically reset the virtual scrolling to the top whenever the items
array undergoes modification.