Modal Controller dismiss function?

I created a modal page according to the documentation:

In particular, I import the modal controller with

import {ModalController} from 'ionic-angular';

declare it in the constructor’s arguments with

constructor(private modalCtrl: ModalController) 

and create the close modal function, which binds a back button, with:

  dismiss() {
    // using the injected ModalController this page
    // can "dismiss" itself and optionally pass back data
      'dismissed': true

The dismiss word is underlined and the message that appears is “Property ‘dismiss’ does not exist on type ‘ModalController’” . Did I miss something?

You have a error, change the import for this

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

Thank you pal, this is the solution.

1 Like