ngx-modal icon indicating copy to clipboard operation
ngx-modal copied to clipboard

Angular 9 Support?

Open PinkTiu opened this issue 5 years ago • 6 comments

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)

PinkTiu avatar Feb 13 '20 08:02 PinkTiu

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 },] }]

turner1979 avatar Feb 14 '20 09:02 turner1979

Here is a pull request for Angular 9 Support https://github.com/Greentube/ngx-modal/pull/56

preeco-privacy avatar Feb 19 '20 12:02 preeco-privacy

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 :)

little-pinecone avatar Feb 20 '20 14:02 little-pinecone

Just upgraded to Angular 9 and found this as well. Would like it fixed.

thecodemonk avatar Apr 15 '20 02:04 thecodemonk

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?

Franky238 avatar Mar 09 '21 15:03 Franky238

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 :)

this answer worked for me. Thanks 👍

molkamoalla avatar Apr 04 '21 22:04 molkamoalla