Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deferLoad not working in Child Components #20

Open
booellean opened this issue Nov 9, 2018 · 9 comments
Open

deferLoad not working in Child Components #20

booellean opened this issue Nov 9, 2018 · 9 comments

Comments

@booellean
Copy link

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.

@BasilioB
Copy link

BasilioB commented Dec 4, 2018

Yes, i second this. Trieed in app.component: works. Tried in some child component: doesnt work. Any idea why?

@BasilioB
Copy link

BasilioB commented Dec 6, 2018

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.

@booellean
Copy link
Author

@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.

@tsenguunchik
Copy link

Any update on this?

@antonioparraga
Copy link

this component is more like un useful if it does not support child components

@keyuls
Copy link

keyuls commented Nov 7, 2019

Any update on this?

@DavidMarquezF
Copy link

Having the same issue

@thesignal
Copy link

thesignal commented Sep 8, 2021

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.

@NickGeek
Copy link
Collaborator

NickGeek commented Sep 9, 2021

@thesignal Awesome! If there's any changes you made when you have time it'd be really sweet to get a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants