-
Notifications
You must be signed in to change notification settings - Fork 142
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
bug(hook): hook won't trigger on lazy-loaded routes #554
Comments
@tjoskar After some investigation this should cause the problem:
Since your examples are not lazy-loaded, providing custom hook works, because they are initialized in Lazy-loaded routes have their own module, where they get the default initialization and provider in app.module.ts is ignored. In this case these lines above. As a workaround you have to apply the provider to each lazy-loaded module, which i would not recommend. It should be possible to apply these settings globally. lazyload-image.directive.ts this.hooks = hooks || new IntersectionObserverHooks(); lazyload.image.module.ts @NgModule({
declarations: [LazyLoadImageDirective],
exports: [LazyLoadImageDirective],
}) |
Hi, I will take a look, but PRs are most welcome. |
Hi @tjoskar, have you had time to look at the issue? |
@DwieDima, unfortunately not. Ever since I got a kid a few months back, I have had almost zero time for my open-source projects. I believe I have to find new maintainers for this project. |
@KirstenStake yes, as a workaround i have to apply the provider in each lazy-module ...
providers: [
// TODO: apply only in app.module when issue is resolved
// https://github.com/tjoskar/ng-lazyload-image/issues/554
{ provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageService },
],
... |
I use the latest version of ionic/angular.
Here I want to add a FadeIn animation when an image is initially loaded. After loading the image, the FadeIn animation should not be executed again on RouteChange.
Currently the hook does not trigger at all (no animation visible, no console logs).
Expected: Hook should trigger
global.scss
Reproduction:
https://stackblitz.com/edit/github-i3f4hm?file=src/app/app.module.ts
i suspect the issue has to do something with the routing of ionic ion-tabs, if you put the images outside of ion-tabs, everything works as expected.
Unfortunately I could not find a solution yet.
The text was updated successfully, but these errors were encountered: