Moshik
Moshik

Reputation: 55

Properly setting up angular 7 with ng-bootstrap

I'm trying to use ng-bootstrap in my project. I searched the net and found that I need to install bootstrap 4 and ng-bootstrap. I initialized a brand new project and installed:

"@ng-bootstrap/ng-bootstrap": "^5.1.0",

"bootstrap": "^4.3.1"

I was then talled to do on my app.module.ts

import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

imports: [NgbModule.forRoot(),
    BrowserModule,
    AppRoutingModule
  ],

The .forRoot() method is unknown and I get the error:

ERROR in src/app/app.module.ts(13,23): error TS2339: Property 'forRoot' does not exist on type 'typeof NgbModule'.

I work with Angular 7.X.

Upvotes: 5

Views: 2960

Answers (1)

Marco Lackovic
Marco Lackovic

Reputation: 6517

Remove .forRoot(), so that your imports will look like this:

imports: [
    NgbModule,
    BrowserModule,
    AppRoutingModule
],

Upvotes: 5

Related Questions