Working with ionic?
See original GitHub issueIs it working with Ionic3?
I tried but it’s rendering all the items instead of only the ones in the content viewport.
Then I tried to pass the Ionic content with:
<virtual-scroll [items]="companies" (update)="viewPortItems = $event" parentScroll="content">
<div *ngFor="let company of viewPortItems">
<company-stats [company]="company" ></company-stats>
</div>
</virtual-scroll>
content variable is defined in my page with
export class CompaniesPage {
@ViewChild(Content) content: Content;
// more stuff here
}
But I got a
Uncaught (in promise): TypeError: parentScroll.addEventListener is not a function
Any ideas? Someone sucessfully implemented it in Ionic?
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Build Your First Ionic Mobile App: Angular Development Tutorial
Ionic's single codebase builds for any platform using just HTML, CSS, & JavaScript. Develop your first mobile app with our step-by-step Angular tutorial....
Read more >How to Get Started with Ionic and Angular
Ionic is a framework that allows us to develop mobile apps and websites using web technologies – HTML, CSS and Javascript basically. The...
Read more >Ionic Tutorial - Tutorialspoint
Ionic is open source framework used for developing mobile applications. It provides tools and services for building Mobile UI with native look and...
Read more >Ionic Tutorial: Build a complete mobile app with Ionic Framework
The most complete Getting Started with Ionic Framework guide ever built. Learn the core concepts of Ionic while building a real mobile app....
Read more >Ionic Tutorial #1 - Overview, installation and creating the project
In this video I will show you a brief summary about the idea of the Ionic Framework, how to install it on your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The way I got it working for me flawlessly, even with the changing number of elements in the list and images :
HTML
CSS
To keep the heights consistent.
TS
Below export class
@ViewChild(Content) _content: Content;
After you get the data from SQL or whatever, set the [bufferAmount] of elements in viewPortItems so it renders correctly
this.viewPortItems = this.items.length > 25 ? _.slice(this.items, 0, 25) : _.cloneDeep(this.items);
Also add this function . Replace 96 with the height of your element ( childHeight was quite buggy with this one )
How did everyone get this to work with Ionic 3?
After installation and adding the markup to my view, I can’t get past this error:
Uncaught (in promise): Error: Template parse errors: Can't bind to 'items' since it isn't a known property of 'virtual-scroll'.
Update: I figured out the issue. I had to import the
VirtualScrollModule
into the child module (where I’m using virtual-scroll) instead my global app module. I imagine it has something to do with the fact that I’m using lazy-loading for components.