角通输入到离子模态

我有一个接受Input参数的组件:

export class MapComponent implements OnInit {
   @Input() options: Mapoptions<any>;
}

I页面使用离子ModalController打开此模态:

async pickLocationmodal() {
  const modal = await this.modalController.create({
    component: MapComponent
  });
  return await modal.present();
}

此外,我还希望将mapoptions存储在页面中。

我可以将mapoptions传递给Modal,以便组件将其作为输入吗?

lingfan2 回答:角通输入到离子模态

我假设您正在使用Ionic,因为这与Ionic的ModalController的实现相同。

根据他们的docs,可以通过传递给componentProps

async pickLocationModal() {
  const modal = await this.modalController.create({
    component: MapComponent,componentProps: { // <----------
      options: ...
    }
  });
  return await modal.present();
}
本文链接:https://www.f2er.com/3155536.html

大家都在问