I am trying to implement infinite scroll in my Angular 4 application. I have followed all the directions from https://www.npmjs.com/package/ngx-infinite-scroll
In the document it says:
By default, the directive listens to the window scroll event and invoked the callback. To trigger the callback when the actual element is scrolled, these settings should be configured:
- [scrollWindow]="false"
- set an explict css "height" value to the element
But the default window scroll event is not triggered in my case. Instead if i set a height for a div element and set [scrollWindow] = "false", then it works in that case. I do not know what am I missing.
Example in given document imports
{ platformBrowserDynamic } from '@angular/platform-browser-dynamic';
but i have not imported that in my module. Is that causing the issue. I think it's not the cause.
Any help will be appreciated. Thanks.
You can achieve infinite scroll functionality without installing extra packages. The below example works for me.
app.component.ts
and your app.component.html