ngx-modal
ngx-modal copied to clipboard
Angular 9 Support?
Are there any plans to support Angular 9?
I get this error when trying to open a modal dialog.
core.js:5828 ERROR TypeError: Cannot read property 'createComponent' of undefined
at ModalDialogComponent.push../node_modules/ngx-modal-dialog/__ivy_ngcc__/src/modal-dialog.component.js.ModalDialogComponent.dialogInit (modal-dialog.component.js:103)
at ModalDialogService.push../node_modules/ngx-modal-dialog/__ivy_ngcc__/src/modal-dialog.service.js.ModalDialogService.openDialog (modal-dialog.service.js:27)
at AppComponent.openNewDialog (app.component.ts:18)
at AppComponent_Template_button_click_2_listener (app.component.html:4)
at executeListenerWithErrorHandling (core.js:21593)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:21635)
at HTMLButtonElement.<anonymous> (platform-browser.js:934)
at ZoneDelegate.invokeTask (zone-evergreen.js:400)
at Object.onInvokeTask (core.js:40744)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
Having a similar issue when upgrading to Angular 9 ( I'm not using the Ivy compiler )
_ERROR TypeError: Cannot read property 'createComponent' of undefined
at ModalDialogComponent.push../node_modules/ngx-modal-dialog/src/modal-dialog.component.js.ModalDialogComponent.dialogInit (modal-dialog.component.js:59)
at ModalDialogService.push../node_modules/ngx-modal-dialog/src/modal-dialog.service.js.ModalDialogService.openDialog (modal-dialog.service.js:26)_
Setting static property to true for ViewChild in section below seemed to fix issue
Line 211 in node_modules/ngx-modal-dialog/src/modal-dialog.component.ts
ModalDialogComponent.propDecorators = {
dynamicComponentTarget: [
{ type: ViewChild, args: ['modalDialogBody', { read: ViewContainerRef, static: true },] }]
Here is a pull request for Angular 9 Support https://github.com/Greentube/ngx-modal/pull/56
I really like this package so I hope that the support for Angular 9 can be added.
In the meantime, I replaced Greentube/ngx-modal with preeco-privacy/ngx-modal:
$ npm uninstall ngx-modal
$ npm i @preeco-privacy/ngx-modal-dialog
And I fixed imports with:
import { ModalDialogService } from '@preeco-privacy/ngx-modal-dialog';
in my components
and
import { ModalDialogModule, ModalDialogInstanceService } from '@preeco-privacy/ngx-modal-dialog';
in my tests
and
import { ModalDialogModule } from "@preeco-privacy/ngx-modal-dialog";
in the app.module.ts
file.
The @preeco-privacy/ngx-modal-dialog fork works with my Angular 9 project and my modals behave and look exactly like when I used the Greentube/ngx-modal dependency :)
Just upgraded to Angular 9 and found this as well. Would like it fixed.
Angular 11 problem, also with @preeco-privacy/ngx-modal-dialog
. The problem is that I cant see the modal window but no error in console. Maybe problem with Ivy? Is there any solution how to avoid the problem with Angular 11 compatibility?
I really like this package so I hope that the support for Angular 9 can be added.
In the meantime, I replaced Greentube/ngx-modal with preeco-privacy/ngx-modal:
$ npm uninstall ngx-modal $ npm i @preeco-privacy/ngx-modal-dialog
And I fixed imports with:
import { ModalDialogService } from '@preeco-privacy/ngx-modal-dialog';
in my components andimport { ModalDialogModule, ModalDialogInstanceService } from '@preeco-privacy/ngx-modal-dialog';
in my tests andimport { ModalDialogModule } from "@preeco-privacy/ngx-modal-dialog";
in theapp.module.ts
file.The @preeco-privacy/ngx-modal-dialog fork works with my Angular 9 project and my modals behave and look exactly like when I used the Greentube/ngx-modal dependency :)
this answer worked for me. Thanks 👍