mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
test(infinitescroll): infinite-scroll w/in nav test
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
import {App, InfiniteScroll} from 'ionic-angular';
|
||||
import {App, Page, InfiniteScroll, NavController} from 'ionic-angular';
|
||||
|
||||
|
||||
@App({
|
||||
@Page({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class E2EApp {
|
||||
class E2EPage1 {
|
||||
items = [];
|
||||
|
||||
constructor() {
|
||||
constructor(private nav: NavController) {
|
||||
for (var i = 0; i < 30; i++) {
|
||||
this.items.push( this.items.length );
|
||||
}
|
||||
@ -30,9 +30,33 @@ class E2EApp {
|
||||
});
|
||||
}
|
||||
|
||||
goToPage2() {
|
||||
this.nav.push(E2EPage2);
|
||||
}
|
||||
}
|
||||
|
||||
function getAsyncData() {
|
||||
|
||||
@Page({
|
||||
template: '<ion-content><button (click)="nav.pop()">Pop</button></ion-content>'
|
||||
})
|
||||
class E2EPage2 {
|
||||
|
||||
constructor(private nav: NavController) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@App({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
class E2EApp {
|
||||
root;
|
||||
constructor() {
|
||||
this.root = E2EPage1;
|
||||
}
|
||||
}
|
||||
|
||||
function getAsyncData(): Promise<any[]> {
|
||||
// async return mock data
|
||||
return new Promise(resolve => {
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
<ion-content>
|
||||
|
||||
<ion-list>
|
||||
<ion-item *ngFor="#item of items">
|
||||
<button ion-item (click)="goToPage2()" *ngFor="#item of items">
|
||||
{{ item }}
|
||||
</ion-item>
|
||||
</button>
|
||||
</ion-list>
|
||||
|
||||
<ion-infinite-scroll (infinite)="doInfinite($event)" threshold="100px">
|
||||
|
Reference in New Issue
Block a user