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

ERROR NullInjectorError: R3InjectorError(AppModule)[NgbDropdown -> NgbDropdown]: NullInjectorError: No provider for NgbDropdown #4691

Open
lelelethu opened this issue Apr 20, 2024 · 1 comment

Comments

@lelelethu
Copy link

When I use angular 15, everything is fine.
When I upgrade angular to 17.3.5, and the latest bootstrap, the following error occurs. Please help me!

Bug description:

ERROR NullInjectorError: R3InjectorError(AppModule)[NgbDropdown -> NgbDropdown]:
NullInjectorError: No provider for NgbDropdown!
at NullInjector.get (core.mjs:1654:27)
at R3Injector.get (core.mjs:3093:33)
at R3Injector.get (core.mjs:3093:33)
at ChainedInjector.get (core.mjs:15723:36)
at lookupTokenUsingModuleInjector (core.mjs:5730:39)
at getOrCreateInjectable (core.mjs:5778:12)
at ɵɵdirectiveInject (core.mjs:11050:19)
at ɵɵinject (core.mjs:1106:60)
at inject (core.mjs:1192:12)
at new NgbDropdownAnchor (ng-bootstrap.mjs:6290:31)

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 17.3.5

ng-bootstrap: 16.0.0

<div ngbDropdown> <i class="fa-regular fa-file-lines fa-xl"></i> <a class="menumain btn" ngbDropdownToggle>{{ 'menu.text' | transloco }}</a> <div ngbDropdownMenu aria-labelledby="dropdownText"> <a ngbDropdownItem routerLink="comparetext" routerLinkActive="router-link-active">{{ 'text.compareText.title' | transloco }}</a> <a ngbDropdownItem routerLink="texttohex" routerLinkActive="router-link-active">{{ 'text.textToHex.title' | transloco }}</a> <a ngbDropdownItem routerLink="texttobase64" routerLinkActive="router-link-active"> {{ 'text.textToBase64.title' | transloco }} </a> </div> </div>

@jnizet
Copy link
Member

jnizet commented Apr 20, 2024

Hi @lelelethu.

You probably forgot to import the NgbDropdown directive.
If you really think this is a bug in ng-bootstrap, then provide a complete minimal reproduction as a stackblitz.

I doubt this is a bug in ng-bootstrap though. So you should be seeking for help elsewhere, like the Angular Discord or Stackoverflow.

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