setItems() update

This commit is contained in:
Adam Bradley
2015-06-30 14:51:18 -05:00
parent 7ba77d119f
commit 6658f5d093
5 changed files with 88 additions and 59 deletions

View File

@@ -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');
}

View File

@@ -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();
}