-
Notifications
You must be signed in to change notification settings - Fork 143
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
Lazyloading images for urls that are not yet ready? #129
Comments
Hi, The directive do not currently support to reload the images when the url changes (become ready), I will however accept a pull request for that :) What you could do in the meantime is something like this: <img *ngIf="image" [lazyLoad]="image"> or if you have a default image: <img *ngIf="!image" [src]="defaultImage">
<img *ngIf="image" [lazyLoad]="image" [defaultImage]="defaultImage"> |
I was just looking for exact same functionality :/ |
@donjae did you ever find a solution? write your own? |
@tjoskar tried
no luck, as it may take up to 10 seconds for my images to be available on the server |
As for my application, I actually just set an |
mmm ok tx :/ |
@donjae ng-lazyload-image/src/lazyload-image.ts Line 79 in d4b3d71
I think a better solution is to create your own scroll-event-emitter that emits a new value when the image is available. |
ok tx! |
I ended up develping my own as I didn't need the scrolling,
and to use it:
and you can also load the image via API:
|
(sorry for late reply) .mergeMap(() => {
return loadImage(imagePath)
.retryWhen(errors => {
return errors.scan((errorCount, err) => {
if(errorCount >= 5) {
throw err;
}
return errorCount + 1;
}, 0)
.delay(1000);
})
}) |
I will close this issue but I will still accept pull request if someone wants to implement it. |
Hi,
Loving the package first off!
I wanted to ask though if it is possible to lazy load images for urls that have yet to be generated. For example, I have users submitting things, but the static URL serving the images aren't ready yet (
GET 404 error
).Is there a possible to lazyload/display images those images when the url is ready. Perhaps by showing either the defaultImage/errorImage until the lazyloaded images work?
The text was updated successfully, but these errors were encountered: