mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
feature(angular): nav-params integrate with router
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { NavController } from '@ionic/angular';
|
||||
import { NavController, NavParams } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'page-three',
|
||||
@ -12,6 +12,9 @@ import { NavController } from '@ionic/angular';
|
||||
</ion-header>
|
||||
<ion-content padding>
|
||||
Page Three {{ts}}
|
||||
<div>isProd: {{isProd}}</div>
|
||||
<div>paramOne: {{paramOne}}</div>
|
||||
<div>paramTwo: {{paramTwo}}</div>
|
||||
<div>
|
||||
<ion-button (click)="navPop()">Go Back</ion-button>
|
||||
</div>
|
||||
@ -22,7 +25,14 @@ import { NavController } from '@ionic/angular';
|
||||
export class PageThree {
|
||||
|
||||
ts: number;
|
||||
constructor(private navController: NavController) {
|
||||
isProd = false;
|
||||
paramOne: any = null;
|
||||
paramTwo: any = null;
|
||||
constructor(private navController: NavController, private navParams: NavParams) {
|
||||
|
||||
this.isProd = navParams.get('isProd');
|
||||
this.paramOne = navParams.get('paramOne');
|
||||
this.paramTwo = navParams.get('paramTwo');
|
||||
|
||||
setInterval(() => {
|
||||
this.ts = Date.now();
|
||||
|
@ -30,7 +30,7 @@ export class PageTwo {
|
||||
}
|
||||
|
||||
pushPageThreeComponent() {
|
||||
this.navController.push('/simple-nav/page-three');
|
||||
this.navController.push('/simple-nav/page-three/jim/halpert');
|
||||
}
|
||||
|
||||
goBack() {
|
||||
|
@ -10,7 +10,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{ path: 'page-one', loadChildren: './page-one/page-one.module#PageOneModule' },
|
||||
{ path: 'page-two', loadChildren: './page-two/page-two.module#PageTwoModule' },
|
||||
{ path: 'page-three', loadChildren: './page-three/page-three.module#PageThreeModule' }
|
||||
{ path: 'page-three/:paramOne/:paramTwo', loadChildren: './page-three/page-three.module#PageThreeModule', data: { isProd: true} }
|
||||
]
|
||||
},
|
||||
];
|
||||
|
Reference in New Issue
Block a user