title: Property 'onDidDismiss' does not exist on type ionic 4 and Angular
body: <p>I am developing an app and I have the next class in TypeScript.</p>
  
  <p>I want to try to get the data in a method of type callback in ´ModalController´ when it dismiss the modal:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core'; 
  import {NavController, ModalController} from '@ionic/angular'; 
  import { Router } from '@angular/router'; 
  import { HomePage } from '../home/home.page'; 
  import {AddItemPage} from '../add-item/add-item.page';
  
  @Component({   
    selector: 'app-todo',   
    templateUrl: './todo.component.html',   
    styleUrls: ['./todo.component.scss']
  })
  
  export class TodoComponent implements OnInit {
  
    public items;
  
    constructor(public navCtrl: NavController, public modalCtrl: ModalController) {
      this.ionViewDidLoad();    
    }
  
    ngOnInit() {}
  
    async addItem()  {
      // Create a modal using MyModalComponent with some initial data 
       const modal = await this.modalCtrl.create({   
          component: AddItemPage,  componentProps: {
             'prop1': "cadena!!!!!!!"   
          } 
       }).then(function(modal) {   
          return modal.present(); 
       });
  
       modal.onDidDismiss(() =&gt; {
          // Call the method to do whatever in your home.ts
          console.log('Modal closed');
      });
    }
  }
  </code></pre>
  
  <p>I got this error:</p>
  
  <blockquote>
    <p>core.js:15724 ERROR Error: Uncaught (in promise): TypeError: Cannot
    read property 'onDidDismiss' of undefinedTypeError: Cannot read
    property 'onDidDismiss' of undefine</p>
  </blockquote>