Reputation: 20995
I have a component which takes in an Input parameter:
export class MapComponent implements OnInit {
@Input() options: MapOptions<any>;
}
I page which opens this modal using the ionic ModalController:
async pickLocationModal() {
const modal = await this.modalController.create({
component: MapComponent
});
return await modal.present();
}
Additionally I have mapOptions stored in the page, which I would like to pass.
I can I pass my mapOptions to the Modal so the component will take it as an input?
Upvotes: 1
Views: 563
Reputation: 11478
I'm assuming you're using Ionic since this is the same implementation of ionic's ModalController
.
According to their docs, it's possible by passing to componentProps
:
async pickLocationModal() {
const modal = await this.modalController.create({
component: MapComponent,
componentProps: { // <----------
options: ...
}
});
return await modal.present();
}
Upvotes: 4