I have 1000 images in a list which are defined in the way below:
<img mat-list-avatar alt="" [src]="file.preview() | async | safe)" />
Since file.preview() takes around 200 milliseconds to execute, I would like to delay load it only for images that are visible in the browser viewport and get loaded bit by bit as the users loads them. So I found loading="lazy" but file.preview() gets executed nonetheless for 1000 images.
<img mat-list-avatar alt="" loading="lazy" [src]="file.preview | async
| safe)" />
Does anyone know why that is? Could that be related to the [src] directive called differently than a plain src attribute? Are there any other alternatives?