mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +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'
|
templateUrl: 'main.html'
|
||||||
})
|
})
|
||||||
class E2EApp {
|
class E2EPage1 {
|
||||||
items = [];
|
items = [];
|
||||||
|
|
||||||
constructor() {
|
constructor(private nav: NavController) {
|
||||||
for (var i = 0; i < 30; i++) {
|
for (var i = 0; i < 30; i++) {
|
||||||
this.items.push( this.items.length );
|
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
|
// async return mock data
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<ion-item *ngFor="#item of items">
|
<button ion-item (click)="goToPage2()" *ngFor="#item of items">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</ion-item>
|
</button>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
<ion-infinite-scroll (infinite)="doInfinite($event)" threshold="100px">
|
<ion-infinite-scroll (infinite)="doInfinite($event)" threshold="100px">
|
||||||
|
Reference in New Issue
Block a user