maximelafarie / ngx-smart-modal

Modal/Dialog component crafted for Angular (Ivy-compatible)
https://maximelafarie.com/ngx-smart-modal/
MIT License
325 stars 85 forks source link

Circular dependency in DI detected for ApplicationRef after ngx-smart-modal and angular upgrade #387

Open Bierat1337 opened 7 months ago

Bierat1337 commented 7 months ago

Hi,

I upgraded Angular 15 to 16 and ngx-smart-modal from 7.1.1 to 14.0.3. After the upgrade I am getting the following error:

Error: NG0200: Circular dependency in DI detected for ApplicationRef. Find more at https://angular.io/errors/NG0200 at throwCyclicDependencyError (core.mjs:228:11) at R3Injector.hydrate (core.mjs:9448:13) at R3Injector.get (core.mjs:9323:33) at injectInjectorOnly (core.mjs:842:40) at Module.ɵɵinject (core.mjs:848:60) at Object.NgxSmartModalService_Factory [as factory] (ngx-smart-modal.mjs:284:104) at core.mjs:9454:43 at runInInjectorProfilerContext (core.mjs:798:9) at R3Injector.hydrate (core.mjs:9453:17) at R3Injector.get (core.mjs:9323:33)

I tried to find the issue, but the circular dependency error isn't caused by any of my created components or services. It seems to be caused by the upgrade of the lib.

Do you guys have any idea how to fix this issue?

regards, Bierat

maximelafarie commented 1 month ago

Hi, there,

sorry, I got married recently and have had a lot going on at the moment which (once again) has made it very difficult for me to refocus.

The problem you are experiencing may be due to the double import of ApplicationRef into NgxSmartModalService. I'm surprised more people haven't had this error. I'm going to get more fixes on board soon, just to make sure the code base is clean.

Stay tuned 🖖