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

Modal in standalone component fails with injection error #6692

Open
maitredede opened this issue Oct 21, 2024 · 1 comment
Open

Modal in standalone component fails with injection error #6692

maitredede opened this issue Oct 21, 2024 · 1 comment

Comments

@maitredede
Copy link

maitredede commented Oct 21, 2024

Hello,

Bug description:

When trying to use BsModalService in a standalone component, the injection fails :

NullInjectorError: R3InjectorError(Standalone[_AppComponent])[_BsModalService -> _BsModalService -> _BsModalService -> RendererFactory2]: 
  NullInjectorError: No provider for RendererFactory2!
    at NullInjector.get (core.mjs:1636:21)
    at R3Injector.get (core.mjs:3018:27)
    at injectInjectorOnly (core.mjs:1096:36)
    at ɵɵinject (core.mjs:1102:40)
    at Object.BsModalService_Factory [as factory] (ngx-bootstrap-modal.mjs:377:59)
    at core.mjs:3136:35
    at runInInjectorProfilerContext (core.mjs:867:5)
    at R3Injector.hydrate (core.mjs:3135:11)
    at R3Injector.get (core.mjs:3009:23)
    at R3Injector.get (core.mjs:3018:27)

Plunker/StackBlitz that reproduces the issue: https://stackblitz.com/edit/stackblitz-starters-9ts86x?file=src%2Fmain.ts

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 18.1.1

Angular: 18.2.8

Bootstrap: 5.3.3

Build system: Angular CLI

Expected behavior

It is expected that dependency injection does not fail and that modal service works as expected.

@lexasq
Copy link
Contributor

lexasq commented Oct 21, 2024

Hi, please refer to the documentation for this https://valor-software.com/ngx-bootstrap/#/components/modals?tab=api
You are now suppose to add BsModalService to providers for your standalone component.

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