-
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
Feature request: Get access to the image in observable creation #304
Comments
@tjoskar as i understand you want to enhance
|
Correct, I may also want to rename
Agree! |
I think this is a nice idea, especially passing a default observer.
I also agree with this. |
Fixed in #365 and in version 2.1.0 |
Motivation and implementation
Right now it's possible to pass an observable which is a great way to extend the library. However, it is a bit limited since the uses can't get access to the image in a simple way.
One of the most common issues is when the user doesn't use the window to scroll or using a 3-part library that adds extra scroll layers (eg. ionic, ng material design, etc), and it can sometimes be hard to find out which element that actually scrolls. One way to solve this could be to use an
Intersection Observer
(which also can give a performance boost). Eg.This is however quite cumbersome.
What we can do is to accept a function as
scrollObservable
, something like:We can not rewrite the component above to:
Better but still a bit noisy, especially when the user wants to use
IntersectionObserver
on all images.A way to solve this could be too pass a default Observable in
NgModule
:We can no rewrite the component above to:
The ability to pass default functions in NgModule could also open up doors to create custom functions for
isVisible
andloadImage
but that is a later story.Would solve: #287, #195, #286, #285, #275, #259 and more. Most of the issues are solved in other ways but it would be a nice if we could give the user more flexibility when creating an observable.
What do you think @sapierens, @rimlin?
The text was updated successfully, but these errors were encountered: