injectIsIntersecting
is a helper function that returns an observable that emits when the component/directive or a given element is being intersected.
To handle this, IntersectionObserver
is being used underneath. The intersection logic runs outside zone for better performance.
Usage
We can use it to listen to component itself being intersected.
Or, we can use it to listen to a given element being intersected.