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.
You can use ng-bootstrap: The Angular version of the Angular UI Bootstrap library which is built from scratch by the ui-bootstrap team using TypeScript and Bootstrap 4 CSS framework. It has two dependencies which are Angular and Bootstrap 4 CSS file. Recently it was updated to use Angular 7.
Yes, you can use parts of Angular Material and Bootstrap together in the same web or mobile project. Developers need to be careful not to use the same components, which can clash. Angular Material and Bootstrap offer a variety of unique components for great website design.
The goal of ng-bootstrap is to completely replace JavaScript implementation for components. Nor should you include other dependencies like jQuery. It is not necessary and might interfere with ng-bootstrap code.
Remove .forRoot(),
so that your imports will look like this:
imports: [
NgbModule,
BrowserModule,
AppRoutingModule
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With