Skip to content
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

Unable to get ScrollSpyInfiniteDirective to work #171

Open
csaldan opened this issue Apr 21, 2017 · 7 comments
Open

Unable to get ScrollSpyInfiniteDirective to work #171

csaldan opened this issue Apr 21, 2017 · 7 comments

Comments

@csaldan
Copy link

csaldan commented Apr 21, 2017

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

@JonnyBGod
Copy link
Owner

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()" >

@csaldan
Copy link
Author

csaldan commented Apr 21, 2017

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

@JonnyBGod
Copy link
Owner

try these imports:

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

@csaldan
Copy link
Author

csaldan commented Apr 21, 2017

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)

@JonnyBGod
Copy link
Owner

What browser are you testing on?

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

@csaldan
Copy link
Author

csaldan commented Apr 21, 2017

using chrome

@JonnyBGod
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants