Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for NgbModalStack

Tags:

ng-bootstrap

For some reason, I am suddenly getting this error out of the blue, with no code changes. Any ideas what would be causing this?

I was able to solve this with adding NgbModule.forRoot() to my imports, but now I get this error:

Property 'forRoot' does not exist on type 'typeof NgbModule'.

the application is running fine otherwise.

like image 985
Wayn Chaw Avatar asked Oct 10 '16 17:10

Wayn Chaw


Video Answer


3 Answers

I've got the same problem with you. I tried to add .forRoot() to NgbModule. Try to configure your @NgModule decorator like this:

   imports: [     BrowserModule,     FormsModule,     HttpModule,     RouterModule.forRoot(appRoutes),     NgbModule.forRoot()   ] 

Hope this help.

like image 59
Hung Vi Avatar answered Sep 28 '22 11:09

Hung Vi


adding this one on my modules.ts works!

  imports: [
NgbModule.forRoot()
]
like image 45
john kevin Lorayna Avatar answered Sep 28 '22 11:09

john kevin Lorayna


For Angular 8, Make sure you have added NgbModule in app.module.ts imports: [ BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(appRoutes), NgbModule // .forRoot() is deprecated in Angular 8 ]

And Downgrading "ng-bootstrap" to 5.x.x worked for me. I found the Angular ng-bootstrap compatibility here. https://www.npmjs.com/package/@ng-bootstrap/ng-bootstrap

like image 27
Naren Reddy Dwarampudi Avatar answered Sep 28 '22 11:09

Naren Reddy Dwarampudi