1

I'm following this doc about Modal in Ionic Angular (https://ionicframework.com/docs/api/modal). I've found this problem and cannot figure out the way to solve.

I'm currently using this version: @ionic/app-scripts : 3.2.4

import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';

 dismiss() {
    this.modalController.dismiss({
      'dismissed': true
    });
  }

Error:

Property 'dismiss' does not exist on type 'ModalController'.ts(2339)

1 Answer 1

2

Try changing your import to this:

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

3
  • I tried this but it prints "Cannot find module '@ionic/angular' or its corresponding type declarations."
    – ChuChuwi
    Commented Dec 15, 2020 at 1:30
  • @ChuwongKul what version of Ionic is your project running?
    – zeropsi
    Commented Dec 15, 2020 at 14:39
  • I've found the solution. It works when I update the Ionic version of my project. Thanks so much for your time :)
    – ChuChuwi
    Commented Dec 15, 2020 at 15:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.