Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standalone component: No provider for LightboxWindowRef! #160

Open
pierresh opened this issue Feb 4, 2024 · 1 comment
Open

standalone component: No provider for LightboxWindowRef! #160

pierresh opened this issue Feb 4, 2024 · 1 comment

Comments

@pierresh
Copy link

pierresh commented Feb 4, 2024

I cannot use ngx-lightbox in standalone component with Angular 15.

However, I imported LightboxModule in my component.

I get the following error:

attachments.service.ts:100 ERROR NullInjectorError: R3InjectorError(Environment Injector)[LightboxWindowRef -> LightboxWindowRef]: 
  NullInjectorError: No provider for LightboxWindowRef!
    at NullInjector.get (core.mjs:7493:27)
    at R3Injector.get (core.mjs:7914:33)
    at R3Injector.get (core.mjs:7914:33)
    at ChainedInjector.get (core.mjs:12084:36)
    at lookupTokenUsingModuleInjector (core.mjs:3201:39)
    at getOrCreateInjectable (core.mjs:3246:12)
    at Module.ɵɵdirectiveInject (core.mjs:10041:12)
    at NodeInjectorFactory.LightboxComponent_Factory [as factory] (lightbox.component.js:568:272)
    at getNodeInjectable (core.mjs:3431:44)
    at createRootComponent (core.mjs:12297:35)
@autumnesponda
Copy link

in case anyone else stumbles upon this, make sure the dependency is injected in the constructor as public; at least that's what solved the problem for me.

    constructor(public _lightbox: Lightbox, public _lightboxConfig: LightboxConfig) { }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants