mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(nav): NavPush and NavPop
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {NavController, NavbarTemplate, Navbar, Content} from 'ionic/ionic';
|
||||
import {NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
||||
import {SecondPage} from './second-page';
|
||||
|
||||
|
||||
@@ -21,10 +21,11 @@ import {SecondPage} from './second-page';
|
||||
'<ion-content class="padding">' +
|
||||
'<p>First Page: {{ val }}</p>' +
|
||||
'<p><button class="button" (click)="push()">Push (Go to 2nd)</button></p>' +
|
||||
'<p><button class="button" [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
|
||||
'<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>' +
|
||||
'</ion-content>',
|
||||
directives: [NavbarTemplate, Navbar, Content]
|
||||
directives: [NavbarTemplate, Navbar, NavPush, Content]
|
||||
})
|
||||
export class FirstPage {
|
||||
constructor(
|
||||
@@ -32,6 +33,11 @@ export class FirstPage {
|
||||
) {
|
||||
this.nav = nav;
|
||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||
|
||||
this.pushPage = SecondPage;
|
||||
this.pushData = {
|
||||
id: 420
|
||||
}
|
||||
}
|
||||
|
||||
viewLoaded() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {NavController, NavParams, NavbarTemplate, Navbar, Content} from 'ionic/ionic';
|
||||
import {NavController, NavPop, NavParams, NavbarTemplate, Navbar, Content} from 'ionic/ionic';
|
||||
import {ThirdPage} from './third-page';
|
||||
|
||||
|
||||
@@ -13,13 +13,16 @@ import {ThirdPage} from './third-page';
|
||||
<p>
|
||||
<button class="button" (click)="pop()">Pop (Go back to 1st)</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="button" nav-pop>Pop with NavPop (Go back to 1st)</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="button" (click)="push()">Push (Go to 3rd)</button>
|
||||
</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>
|
||||
`,
|
||||
directives: [NavbarTemplate, Navbar, Content]
|
||||
directives: [NavbarTemplate, NavPop, Navbar, Content]
|
||||
})
|
||||
export class SecondPage {
|
||||
constructor(
|
||||
|
||||
Reference in New Issue
Block a user