Open booellean opened 6 years ago
Yes, i second this. Trieed in app.component: works. Tried in some child component: doesnt work. Any idea why?
Ok, I'm gone deeper and found out:
Object.keys(entry).length in line 80 is 0 so the fallback (check page and element offset isVisible()) is taken to check, whether to load the image or not. But entry is an IntersectionObserverEntry with keys and values inside.
Now, all offsets of images where smaller than scrollY + clientHeight, cause they where not loaded and didnt take any space. If I give them space it works. But upper problem still exists.
@BasilioB thank you for checking on that. i'm going to check this out again and see if I can find anything else as well.
Any update on this?
this component is more like un useful if it does not support child components
Any update on this?
Having the same issue
Hi, i came across the same issue - in my child module deferLoad wasn't working. The child module (also lazy loaded via route) is a template which I use in an ngFor loop, it lazyloads preview images for each element.
I wanted so dig into it so I set it up as a directive in my project ... and now it's working (just created the directive with "ng generate directive" and copy pasted the code + added the module. I don't have time to look at it now (works, don't care :P ) but might look into it sooner or later. Can't explain why but maybe it helps someone.
@thesignal Awesome! If there's any changes you made when you have time it'd be really sweet to get a PR.
I did not try with the app.module, but I followed the example link pretty closely and this is the only difference I could find.
When deferLoad is used in a child component, it will load all images that are presently in the initial viewport but fail to load any images on new images that come to the viewport thereafter.