-
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
Lazyloaded Image stays in "setup" state after URL change #473
Comments
Hey @joe991 Does your component look something like? @Component({
selector: 'async-image',
template: `
<img [defaultImage]="defaultImage" [lazyLoad]="image" (mouseEnter)="mouseEnter()" (mouseLeave)="mouseLeave()" />
`
})
class MyComponent {
defaultImage = 'https://www.placecage.com/300/300';
image = 'https://picsum.photos/id/236/300/300';
mouseLeave() {
this.image = 'https://picsum.photos/id/236/300/300';
}
mouseEnter() {
this.image = 'https://picsum.photos/id/237/300/300';
}
} This will:
It sounds like this is not the behavior you want? It is possible to skip the default image when you change the image path if that is what you want. |
Hey @tjoskar Not quite: Template:
Typescript:
The URL is changed by a parent component which works the way that you suggested. However, during debugging, the lazyloading image just has the "ready" state if the URL is changed too quickly. |
I'm observing a pretty similar behavior, where the loading of images is stuck in "setup" state and cannot be recovered even if the underlying img-src changes. For me this can be reproduced as follows:
See a minimal reproduction of the issue at https://stackblitz.com/edit/angular-ivy-pca22x?file=src/app/app.component.html For me, providing a custom
|
I am also experiencing a similar issue. In my case, there is cell reuse involved (through cdk-virtual-scroll-viewport), but I think the problem is happening for the same reason, though. In the end, I am trying to change the https://stackblitz.com/edit/angular-ivy-qgdkdb I have also verified that @ClemensSchneider's modified Any thoughts on a permanent fix for this? |
I am using this very well made module for product images on a category page. Upon hover, the URL of the shown image changes to show other angles of said product.
Moving the mouse at exactly the right moment (exiting the hover, which changes the URL back to the original image) results in the lazyloaded image staying in the "setup" state - even when changing the URL again - which means that it turns back to the default image, without registering the fact that it is currently 'in view'.
Any ideas?
The text was updated successfully, but these errors were encountered: