0

when using the angular cdk-virtual-scroll as per below code, content displays correctly before image loaded. however, after the image is loaded, scrolling seems to work incorrectly.

in this case, scroll direction is vertical. as scrolling occurs, extra white space is added to the bottom of the parent viewport.

I would speculate that the scroll element determined child sizes before image load and therefore the height of each child does not match actual child height after image load.

question is what are my options to work around this problem, please.

<cdk-virtual-scroll-viewport sytle="height: 500px" autosize>

<div *cdkVirtualFor="let item of items | async">

<img *ngIf="item.source" src={{item.source}}>
<div>
{{item.text}}
</div>

</div>

</cdk-virtual-scroll-viewport>

0 Answers0