feat(virtualScroll): init virtual scroll

Closes #5418
This commit is contained in:
Adam Bradley
2016-04-05 14:49:58 -05:00
parent 0701338484
commit 7679ac08f5
17 changed files with 2338 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
import {ViewChild, ElementRef} from 'angular2/core';
import {App, Page} from 'ionic-angular';
@Page({
templateUrl: 'main.html'
})
class E2EPage {
items = [];
@ViewChild('content') content: ElementRef;
constructor() {
for (var i = 0; i < 14; i++) {
this.items.push(i);
}
}
headerFn(record: any, index: number, records: any[]) {
if (index % 4 === 0) {
return index + ' is divisible by 4';
}
return null;
}
reload() {
window.location.reload(true);
}
}
@App({
template: '<ion-nav [root]="root"></ion-nav>'
})
class E2EApp {
root;
constructor() {
this.root = E2EPage;
}
}

View File

@@ -0,0 +1,27 @@
<ion-navbar *navbar>
<ion-title>Virtual Scroll</ion-title>
<ion-buttons end>
<button (click)="reload()">
Reload
</button>
</ion-buttons>
</ion-navbar>
<ion-content>
<ion-list [virtualScroll]="items"
[headerFn]="headerFn">
<ion-item-divider *virtualHeader="#header">
Header: {{header}}
</ion-item-divider>
<ion-item *virtualItem="#item">
Item: {{item}}
</ion-item>
</ion-list>
</ion-content>