Cannot create a modal


#1

I get this when I try to create and present a modal:

ERROR TypeError: Cannot read property ‘create’ of undefined
at SingleComponent.webpackJsonp.321.SingleComponent.openModal (VM4210 1.main.js:859)
at Object.eval [as handleEvent] (VM4222 SingleComponent.ngfactory.js:312)
at handleEvent (VM4068 main.js:12275)
at callWithDebugContext (VM4068 main.js:13567)
at Object.debugHandleEvent [as handleEvent] (VM4068 main.js:13155)
at dispatchEvent (VM4068 main.js:9175)
at VM4068 main.js:9767
at HTMLButtonElement. (VM4068 main.js:33622)
at t.invokeTask (VM4067 polyfills.js:3)
at Object.onInvokeTask (VM4068 main.js:4501)

my code:
openModal(table_name?) {
let myModal = this.modalCtrl.create(ModalPage, {bundle: this.bundle, table_name: table_name, appendix: “/list”});
myModal.onDidDismiss(data => {
// console.log("the choosen one: ", data);
this.toast.create({
message: 'Button: '+ data,
duration: 5000
}).present();
});
I swear it uset to work, I did not change a thing, at one poit this error shows up,
this is the ionic version;

@ionic/cli-utils  : 1.10.2
ionic (Ionic CLI) : 3.10.3

local packages:

@ionic/app-scripts : 1.3.12
Ionic Framework    : ionic-angular 3.5.0

System:

Node : v6.10.3
npm  : 3.10.10
OS   : Windows 10

#2

Looks as though you’re injecting ModalController incorrectly. What’s the method signature of your constructor?