如何传递和离子3得到模态数据?

问题描述 投票:1回答:1

在我的应用程序离子,我点击一个按钮后,打开模型。我需要将数据传递给模态抓住它的模式。我怎样才能做到这一点。

这是我的代码。

home.html的

<button ion-button (click)="openDialog()">open</button>

home.ts

  openDialog() {
    let dialog = this.modal.create(MyPage);
    dialog.present();
  }
ionic-framework ionic3
1个回答
0
投票

您可以将数据传递给modal作为create方法的第二个参数。

let dialog = this.modal.create(MyPage, { title: 'This is MyPage Page'});

您可以使用modalNavParams获取数据。

  constructor(public navParam: NavParams) {

    this.title = this.navParam.get('title');

  }
© www.soinside.com 2019 - 2024. All rights reserved.