分为用链接类似的连转和在方法器里跳转,这里做的要比1好的多
1、首先说在方法器跳转
原文链接 http://ionicframework.com/docs/v2/api/components/nav/NavPush/
import {Contact1Page} from "../contact1/contact1";
goToOtherPage() {
this.navCtrl.push(Contact1Page, {id: "sam"});//带上参数传输到下个页面 }
在新的页面用this.navParams.get('id')获取参数
console.log(this.navParams.get('id'));
2、直接用链接也就是navPush的方式
页面
<button ion-item [navPush]="nxPage" [navParams]="params">
点击直接带参数调转
</button>
js
import {Contact1Page} from "../contact1/contact1";
nxPage: any = Contact1Page;
params: any = {id: 42};
至于接参数是和上一个是一样的
1、首先说在方法器跳转
原文链接 http://ionicframework.com/docs/v2/api/components/nav/NavPush/
import {Contact1Page} from "../contact1/contact1";
goToOtherPage() {
this.navCtrl.push(Contact1Page, {id: "sam"});//带上参数传输到下个页面 }
在新的页面用this.navParams.get('id')获取参数
console.log(this.navParams.get('id'));
2、直接用链接也就是navPush的方式
页面
<button ion-item [navPush]="nxPage" [navParams]="params">
点击直接带参数调转
</button>
js
import {Contact1Page} from "../contact1/contact1";
nxPage: any = Contact1Page;
params: any = {id: 42};
至于接参数是和上一个是一样的