在我的应用程序离子,我点击一个按钮后,打开模型。我需要将数据传递给模态抓住它的模式。我怎样才能做到这一点。
这是我的代码。
home.html的
<button ion-button (click)="openDialog()">open</button>
home.ts
openDialog() {
let dialog = this.modal.create(MyPage);
dialog.present();
}
您可以将数据传递给modal
作为create
方法的第二个参数。
let dialog = this.modal.create(MyPage, { title: 'This is MyPage Page'});
您可以使用modal
在NavParams
获取数据。
constructor(public navParam: NavParams) {
this.title = this.navParam.get('title');
}