BsDropdownDirective StaticInjectorError

Topic: BsDropdownDirective StaticInjectorError

bfk.portal pro asked 2 years ago


I tried to start up my Angular Applikation which worked 5 days ago but now I get an staticInjectorError with the BsDropdownDirective although i didn't even touch it. I have a dropdown in my navbar

<a dropdownToggle type="button" class="nav-link dropdown-toggle waves-light text-white" mdbWavesEffect><br> {{getDropdownName()}}<br> </a><br> <div class="dropdown-menu dropdown-primary dropdown-menu-right" role="menu"><br> <a class="dropdown-item" href="#" (click)="onLogout()">Abmelden</a><br> </div>

Like this but it always worked. I dont know from where the error is coming all of the sudden. I even tried to update everything but no success.This is the errorenter image description here

Best Regards

Matthias Herzog

Edit: As of now it seems to work if I write DropdownModule.forRoot() the same goes for some other Modules too. But I don't get it why because it worked before without forRoot()?

Damian Gemza staff answered 2 years ago

Dear bfk.portal,

With the 7.4.0 we have changed the compilation tool of our library.

With the compilator change, we have resolved problems with the Three-Shaking of our library.

The DropdownModule requires .forRoot() method because there are some classes, which should be used globally.

Best Regards,


Please insert min. 20 characters.