ionic 4 - how to retrieve data passed to a modal

You need to use @Input() decorator.

async presentModal() {
    const modal = await this.modalController.create({
      component: ModalPage,
      componentProps: { value: 123 }
    });
    return await modal.present();
  }

Component:

@Component({
  selector: 'ModalPage',
  templateUrl: './ModalPage.component.html',
  styleUrls: [ './ModalPage.component.css' ]
})
export class ModalPage  {
  name = 'Angular';
  @Input() value: any;
}

Navparams still works in Ionic 4 Beta-15

Page1.ts

   import { ModalPage } from './modal.page';

   async presentModal() {
    const modal = await this.modalController.create({
      component: ModalPage,
      componentProps: { value: 123 }
    });

    //insert onDidDismiss() here

    return await modal.present();
   }

ModalPage.ts

import { NavParams } from '@ionic/angular';

  export class ModalPage {
  public value = this.navParams.get('value');

  constructor(private navParams: NavParams) {}

}

To get a returned value from the ModaPage to Page1:

Page1.ts

modal.onDidDismiss().then((data) => {
  console.log(data);
})

IMPORTANT:

  1. To use ModalPage inside Page1 you need to import ModalPageModule module inside page1.module.ts file.