mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
docs(demos): nav param demo
This commit is contained in:
2
demos/nav-params/app.html
Normal file
2
demos/nav-params/app.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
||||||
|
<ion-overlay></ion-overlay>
|
41
demos/nav-params/index.ts
Normal file
41
demos/nav-params/index.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||||
|
import {NavController, NavParams} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
|
@App({
|
||||||
|
templateUrl: 'app.html'
|
||||||
|
})
|
||||||
|
class ApiDemoApp {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.rootPage = InitialPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Page({
|
||||||
|
templateUrl: 'main.html'
|
||||||
|
})
|
||||||
|
export class InitialPage {
|
||||||
|
constructor(nav: NavController) {
|
||||||
|
this.nav = nav;
|
||||||
|
this.myParam = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
pushParams() {
|
||||||
|
this.nav.push(Page2, { 'myParam': this.myParam });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Page({
|
||||||
|
templateUrl: "page-2.html"
|
||||||
|
})
|
||||||
|
export class Page2 {
|
||||||
|
constructor(
|
||||||
|
nav: NavController,
|
||||||
|
params: NavParams
|
||||||
|
) {
|
||||||
|
this.nav = nav;
|
||||||
|
this.myParam = params.get('myParam');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
14
demos/nav-params/main.html
Normal file
14
demos/nav-params/main.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<ion-navbar *navbar>
|
||||||
|
<ion-title>Nav Params</ion-title>
|
||||||
|
</ion-navbar>
|
||||||
|
|
||||||
|
<ion-content padding>
|
||||||
|
<ion-row>
|
||||||
|
<ion-input style="width: 100%">
|
||||||
|
<input type="text" placeholder="Params" [(ng-model)]="myParam">
|
||||||
|
</ion-input>
|
||||||
|
</ion-row>
|
||||||
|
<ion-row>
|
||||||
|
<button secondary full block (click)="pushParams()">Push Params</button>
|
||||||
|
</ion-row>
|
||||||
|
<ion-content>
|
7
demos/nav-params/page-2.html
Normal file
7
demos/nav-params/page-2.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<ion-navbar *navbar>
|
||||||
|
<ion-title>Modals</ion-title>
|
||||||
|
</ion-navbar>
|
||||||
|
|
||||||
|
<ion-content padding>
|
||||||
|
<div>Parameters entered: {{myParam}}</div>
|
||||||
|
</ion-content>
|
Reference in New Issue
Block a user