mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
setItems() update
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import {IonicComponent, IonicView, IonicConfig, IonicApp, Routable} from 'ionic/ionic';
|
||||
import {NavParams, NavController} from 'ionic/ionic';
|
||||
|
||||
import {SecondPage} from './second-page'
|
||||
import {SecondPage} from './second-page';
|
||||
import {ThirdPage} from './third-page';
|
||||
|
||||
|
||||
@IonicComponent({
|
||||
@@ -23,6 +24,7 @@ import {SecondPage} from './second-page'
|
||||
'<p>First Page: {{ val }}</p>' +
|
||||
'<p><button primary (click)="push()">Push (Go to 2nd)</button></p>' +
|
||||
'<p><button primary [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
|
||||
'<p><button primary (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
|
||||
'<icon class="ion-ios-arrow-back"></icon>' +
|
||||
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
||||
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
||||
@@ -45,6 +47,14 @@ export class FirstPage {
|
||||
}
|
||||
}
|
||||
|
||||
setItems() {
|
||||
let items = [
|
||||
ThirdPage
|
||||
];
|
||||
|
||||
this.nav.setItems(items);
|
||||
}
|
||||
|
||||
viewLoaded() {
|
||||
console.log('viewLoaded first page');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {IonicComponent, IonicView, Routable, NavController, NavParams} from 'ionic/ionic';
|
||||
import {ThirdPage} from './third-page';
|
||||
import {FirstPage} from './first-page';
|
||||
|
||||
|
||||
@IonicComponent({
|
||||
@@ -12,18 +13,11 @@ import {ThirdPage} from './third-page';
|
||||
template: `
|
||||
<ion-navbar *navbar><ion-title>Second Page Header</ion-title></ion-navbar>
|
||||
<ion-content class="padding">
|
||||
<p>
|
||||
<button primary (click)="pop()">Pop (Go back to 1st)</button>
|
||||
</p>
|
||||
<p>
|
||||
<button primary nav-pop>Pop with NavPop (Go back to 1st)</button>
|
||||
</p>
|
||||
<p>
|
||||
<button primary (click)="push()">Push (Go to 3rd)</button>
|
||||
</p>
|
||||
<p>
|
||||
Random: {{ val }}
|
||||
</p>
|
||||
<p><button primary (click)="pop()">Pop (Go back to 1st)</button></p>
|
||||
<p><button primary nav-pop>Pop with NavPop (Go back to 1st)</button></p>
|
||||
<p><button primary (click)="push()">Push (Go to 3rd)</button></p>
|
||||
<p><button primary (click)="setItems()">setItems() (Go to 3rd, FirstPage 1st in history)</button></p>
|
||||
<p>Random: {{ val }}</p>
|
||||
<div class="green"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
|
||||
</ion-content>
|
||||
`
|
||||
@@ -40,6 +34,15 @@ export class SecondPage {
|
||||
console.log('Second page params:', params);
|
||||
}
|
||||
|
||||
setItems() {
|
||||
let items = [
|
||||
FirstPage,
|
||||
ThirdPage
|
||||
];
|
||||
|
||||
this.nav.setItems(items);
|
||||
}
|
||||
|
||||
pop() {
|
||||
this.nav.pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user