ngx-infinite-scroll icon indicating copy to clipboard operation
ngx-infinite-scroll copied to clipboard

ngx-infinite-scroll {resolveContainerElement()}: selector for

Open dougse opened this issue 3 years ago • 5 comments

With version 8.0.2, I encounter:

Error: ngx-infinite-scroll {resolveContainerElement()}: selector for at resolveContainerElement (ngx-ins-utils.ts:18) at createScroller (scroll-register.ts:16) at infinite-scroll.directive.ts:66 at ZoneDelegate.invoke (zone.js:386) at Zone.run (zone.js:143) at NgZone.runOutsideAngular (core.js:28464) at InfiniteScrollDirective.setup (infinite-scroll.directive.ts:65) at InfiniteScrollDirective.ngAfterViewInit (infinite-scroll.directive.ts:44) at callHook (core.js:2521) at callHooks (core.js:2492)

Which then results in angular failing to render the page and/or some repositioning issues.

Tips please - Thanks

dougse avatar Mar 10 '21 14:03 dougse

I'm having this problem when running the tests.

"jest": "^26.6.3",

My implementation:

<div class="card-columns"
     infiniteScroll
     [infiniteScrollDistance]="1"
     [infiniteScrollThrottle]="50"
     (scrolled)="onScroll()"
     [infiniteScrollContainer]="'.parent-container'"
     [fromRoot]="true"
     [hidden]="isLoading">
</div>

meyer20 avatar Apr 01 '21 20:04 meyer20

core.js:6210 ERROR Error: ngx-infinite-scroll {resolveContainerElement()}: selector for at resolveContainerElement (ngx-infinite-scroll.js:30) at createScroller (ngx-infinite-scroll.js:524) at ngx-infinite-scroll.js:676 at ZoneDelegate.invoke (zone-evergreen.js:364) at Zone.run (zone-evergreen.js:123) at NgZone.runOutsideAngular (core.js:28520) at InfiniteScrollDirective.setup (ngx-infinite-scroll.js:672) at InfiniteScrollDirective.ngAfterViewInit (ngx-infinite-scroll.js:643) at callHook (core.js:2573) at callHooks (core.js:2542)

I have a main container, i open a side right bar... and inside that right bar i want the scroll. But the issue is... the data is loaded with the main container scroll.

Can anybody help?

DavidPrata avatar Oct 29 '21 17:10 DavidPrata

What I found is that it is somehow not able to find [infiniteScrollContainer]="'.parent-container'" so it is throwing this error. I somehow managed to use scroll without this function.

osamamalik2000 avatar Sep 30 '22 09:09 osamamalik2000

You can pass the ElementRef type to infiniteScrollContainer:

<div #containerRef style="height: 100vh; overflow-y: auto;">
  <div infiniteScroll
       [infiniteScrollDistance]="2"
       [infiniteScrollThrottle]="50"
       [infiniteScrollContainer]="containerRef">
  </div>
</div>
  • Notice that in the container element height must be fixed and the overflow must be set to auto or scroll.

mahdizarei0614 avatar Oct 27 '22 23:10 mahdizarei0614

You can pass the ElementRef type to infiniteScrollContainer:

<div #containerRef style="height: 100vh; overflow-y: auto;">
  <div infiniteScroll
       [infiniteScrollDistance]="2"
       [infiniteScrollThrottle]="50"
       [infiniteScrollContainer]="containerRef">
  </div>
</div>
  • Notice that in the container element height must be fixed and the overflow must be set to auto or scroll.

This worked for me Thanks a lot

nirajdgrooar avatar Dec 12 '22 13:12 nirajdgrooar