一级页面
1.创建按钮
<button ion-button (click)="presentCtrl()">跳转</button>
2、构造函数
constructor(public navCtrl: NavController,public modalCtrl: ModalController) {
this.dataArr = ["a","b","c"];
this.myParam = "123";
// this.modelP = ModelPage;
}
- 动作
presentCtrl(){
let myModal = this.modalCtrl.create( ModelPage, { 'myParam': this.myParam });
myModal.present();
// this.navCtrl.push(this.modelP);
}
二级页面 // 获取界面跳转的参数
constructor(
public viewCtrl: ViewController,
params: NavParams
) {
// 获取界面跳转的参数
this.myParam = params.get('myParam');
}
返回
// 界面 消失
dismissCtrl(){
this.viewCtrl.dismiss();
}