question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NgModule suggestion, also "No Provider for NgbDropdown" bug

See original GitHub issue

Bug description:

First of all, thanks for your library. We switched from ng2-bootstrap and so far we like this one better 😉

Okay, so you guys recommend Users to import the NgbModule inside our AppModule - why?

Okay, you don’t have to import any other module from ng-bootstrap in components that are declared in AppModule. That’s about it.

We in our project like to only include modules that are actually used. We are using webpack to build everything. So with importing NgbModule the app.js grows in size a lot.

Right now we are doing something like this:

import {NgbDropdownModule} from "@ng-bootstrap/ng-bootstrap/dropdown/dropdown.module";

It would be nice to be able to do something like this:

import {NgbDropdownModule} from "@ng-bootstrap/ng-bootstrap/dropdown";

(So there’d be an index.js exporting all members of NgbDropdown).


Also, there is a bug: https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/dropdown/dropdown.module.ts#L10 When including NgbDropdownModule we get No Provider for NgbDropdown as Exception since NgbDropdown isn’t included in the providers array and therefore we must include it in our AppModule’s providers array.

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 2.4.5

ng-bootstrap: 1.0.0.alpha.20

Bootstrap: 4.0.0-alpha.6

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alex321commented, Feb 10, 2017

@dhardtke I see what you are after now. Here’s an updated plunker for your use case that does exactly what you wanted (you can see also that only the dropdown is loaded).

http://plnkr.co/edit/tMdJ1Us9pRVM3OB2MTCX?p=preview

The plunker that you have provided has a 500 error as you are getting the bundle, etc. and the path you have provided is wrong. Let me know whether there is anything amiss in this one.

1reaction
pkozlowski-opensourcecommented, Feb 9, 2017

@dhardtke thnx for the warm words. Could you please reproduce in a plunker the issue with providers that you are mentioning here? Please note that you need to use the MgbDropdownModule.forRoot() when importing in the app module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No provider for NgbDropdown with Angular Bootstrap
I am attempting to use the NbgDropdown in an app and I get the following error: NullInjectorError: No provider ...
Read more >
Dropdown - Angular powered Bootstrap
A directive that provides contextual overlays for displaying lists of links and more. Selector: '[ngbDropdown]'. Exported as: 'ngbDropdown'. Inputs ...
Read more >
Addapt bootstrap theme for web application-angular.js
I will try to be the clearest I can be. The theme you purchaised is just plain html with css (Bootstrap). What you...
Read more >
ngbdropdown module的推薦與評價, 網紅們這樣回答
ngbdropdown module 在NgModule suggestion, also "No Provider for NgbDropdown" bug 的相關結果. We in our project like to only include modules that are ...
Read more >
Angular 14 Select Dropdown with Reactive Forms Examples
Also, we will take help of SelectControlValueAccessor directive; ... FormsModule } from '@angular/forms'; @NgModule({ declarations: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found