pass data to component ionic code example
Example: ionic modal pass data
...
async presentModal() {
const modal = await this.modalController.create({
component: ModalPage,
componentProps: {
foo: 'hello',
bar: 'world'
}
});
return await modal.present();
}
...
@Component()
export class ModalPage implements OnInit {
foo;
bar;
ngOnInit() {
console.log(`${foo} ${bar}`)
}
}