Has anyone gotten VirtualScroll to work on Ionic 2 RC 0? It is not working for me. I tried to just make the simplest possible code to demonstrate the functionality. Am I missing something or does it just not work?
I have problems with virtual scroll too. I have the following error in chrome:
polyfills.js:3 Unhandled Promise rejection: Template parse errors:
Can't bind to 'virtualTrackBy' since it isn't a known property of 'ion-card'.
1. If 'ion-card' is an Angular component and it has 'virtualTrackBy' input, then verify that it is part of this module.
2. If 'ion-card' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
(" (click)="ViewArticle($event, article, null)"
[ERROR ->][virtualTrackBy]="id"
I try to isolate the problem.
If anyone make the virtual scroll to work, that would be a clue.
EXCEPTION: Error in ./ContactPage class ContactPage - inline template:9:2 caused by: Cannot read property ‘indexOf’ of undefined
ORIGINAL EXCEPTION: Cannot read property ‘indexOf’ of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property ‘indexOf’ of undefined
Template:
<ion-list [virtualScroll]="items">
<ion-list-header>Follow us on Twitter</ion-list-header>
<ion-item *virtualItem="let item">
<ion-icon name="ionic" item-left></ion-icon>
{{item}}
</ion-item>
Component:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
templateUrl: 'contact.html'
})
export class ContactPage {
public items: Array<string> = [];
constructor(public navCtrl: NavController) {
for(let i = 0; i < 100; i++)
{
this.items.push('name' +i);
}
}
}
Yea, that workaround did fix my issue. I thought I had tried that fix before, but I guess I had another issue when I had tried it. But yea, the workaround described in the github did fix my error that I was receiving. The workaround was to just define approxItemHeight (such as approxItemHeight=“40px”) on the ion-list element.