JonnyBGod / ngx-scrollspy

Angular ScrollSpy Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to get ScrollSpyInfiniteDirective to work

csaldan opened this issue · comments

commented

I cant seem to get ScrollSpyInfiniteDirective to work. I have added ScrollSpyInfiniteDirective to declarations in my module and ScrollSpyModule.forRoot() to my module imports. I added scrollSpy to my top level div and in my component i have imported ScrollSpyInfiniteDirective and set up my template as follows:

<div class="app-body" scrollSpyInfinite (scrollSpyInfiniteEvent)="scrollDown()">

But i do not see scrollDown() being called on scrolling all the way to the bottom. Is it possible to get some documentation on how to use it?

Thanks

You have to pass the spyId you want to subscribe to.
So if your using scrollSpy subscribe to window, try:

<div class="app-body" [scrollSpyInfinite]="{spyId: 'window', distanceRatio: 0.5}" (scrollSpyInfiniteEvent)="scrollDown()" >

commented

I tried that but I get this error: "Error: Template parse errors:↵Can't bind to 'scrollSpyInfinite' since it isn't a known property of 'div'"

Do I need to specify the spyId, shouldnt it just use the defaults of spyId

try these imports:

 imports: [
        ScrollSpyModule.forRoot(),
        ScrollSpyInfiniteModule
      ],
commented

I am seeing this error:
TypeError: Cannot read property 'documentElement' of undefined at ScrollSpyInfiniteDirective.evaluateScroll (infinite.directive.js:36) at SafeSubscriber._next (infinite.directive.js:26)

What browser are you testing on?

Sorry this directive is experimental, it needs a bit more testing.

commented

using chrome

Oh that is odd because I tested in chrome at the time as well.

I will have a look into it tomorrow. 5am now got to do some sleeping.