Ngx-infinite-scroll: add example to infiniteScrollContainer

Created on 20 Sep 2017  路  3Comments  路  Source: orizens/ngx-infinite-scroll

Can you add an example of infiniteScrollContainer

I tried using @elemenRef and @brainsiq viewChild and pass this elementRef to the @input()
html div(class="mycontainer") // container of the masonry

js @ViewChild('mycontainer') mycontainer: ElementRef;
But it do not work.

If I passed a string, a string of what a css class ? for example if have a container .mycontainer and I pass infiniteScrollContainer=".mycontainer" or infiniteScrollContainer=".mycontainer"

But it do not work and I do not know how to fix.

enhancement help wanted NOT a bug

Most helpful comment

I've also stumbled upon the lack of example on this case.

It turns out that you can use two methods.
1) In your component.html:

[infiniteScrollContainer]="selector"

and in your component.ts:

selector: string = '.mycontainer';

2) or if you don't want to use one more variable in your .ts file, you can just use single quotes inside double quotes:

[infiniteScrollContainer]="'.mycontainer'"

Also, if you want to point to an element that is outside the infiniteScroll directive you have to use [fromRoot]="true". Even though it is explained in the documentation, I had a hard time finding out what I was missing.

All 3 comments

I've also stumbled upon the lack of example on this case.

It turns out that you can use two methods.
1) In your component.html:

[infiniteScrollContainer]="selector"

and in your component.ts:

selector: string = '.mycontainer';

2) or if you don't want to use one more variable in your .ts file, you can just use single quotes inside double quotes:

[infiniteScrollContainer]="'.mycontainer'"

Also, if you want to point to an element that is outside the infiniteScroll directive you have to use [fromRoot]="true". Even though it is explained in the documentation, I had a hard time finding out what I was missing.

@ymatus nicely explained.
i havn't had the time to document this and others as much as i want to. it's on my todo list. please feel free to open a pr with your explanation.
cheer.s

closed by #206

Was this page helpful?
0 / 5 - 0 ratings