9

I installed ngx infinite scrolling ngx-InfiniteScroll using :

  npm install ngx-infinite-scroll --save

In my app.module I added :

import {InfiniteScrollModule} from 'ngx-infinite-scroll';

And in my imports I added :

  imports: [
 BrowserModule,
 FormsModule,
 AppRoutingModule,
 BrowserAnimationsModule,
 InfiniteScrollModule,
 NgbModule.forRoot()
]

And then in my component.ts I added again :

 import { InfiniteScrollModule } from 'ngx-infinite-scroll';

In my html I have :

<div class="col-md-12 tableDiv" infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="100" (scrolled)="onScroll()">
  /*table with content here */

And the error I get is that infiniteScrollDistance isn't a known property of 'div', and can't bind to it . What I am doing wrong ? What step am I missing ? I have used it before and it has worked. But now I can't seem to get it to do so. Any hint ?

1 Answers1

3

Maybe you added it to the main module instead of the shared module.

app.module.ts

instead of

shared.module.ts

If your component is in the shared module.

also:

in this example the syntax is different:

<div class="search-results" infinite-scroll

instead of:

<div class="search-results" infiniteScroll

https://stackblitz.com/edit/ngx-infinite-scroll-rz1jjz?file=src%2Fapp%2Fapp.component.ts

mruanova
  • 6,351
  • 6
  • 37
  • 55