This repository contains a set of native Angular directives based on Bootstrap's markup and CSS. As a result no dependency on jQuery or Bootstrap's JavaScript is required. The only required dependencies are:
Should I add bootstrap.js or bootstrap.min.js to my project?
No, the goal of ng-bootstrap is to completely replace JavaScript implementation for components. Nor should you include other dependencies like jQuery or popper.js. It is not necessary and might interfere with ng-bootstrap code.We strive to support the same browsers and versions as supported by both Bootstrap 4 and Angular, whichever is more restrictive. Check browser support notes for Angular and Bootstrap.
Our code is automatically tested on all the supported browsers.
After installing the above dependencies, install ng-bootstrap
via: npm install --save @ng-bootstrap/ng-bootstrap
Once installed you need to import our main module.
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
The only remaining part is to list the imported module in your root module and any additional application modules that make use
of the components in this library. The exact method will be slightly different for the root (top-level) module for which you
should end up with the code similar to (notice NgbModule.forRoot()
):
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [AppComponent, ...], imports: [NgbModule.forRoot(), ...], bootstrap: [AppComponent] }) export class AppModule { }
Other modules in your application can simply import NgbModule
:
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [OtherComponent, ...], imports: [NgbModule, ...] }) export class OtherModule { }
If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.
In your systemjs config file, map
needs to tell the System loader where to look for ng-bootstrap
:
map: {
'@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
}
Please, do not open issues for the general support questions as we want to keep GitHub issues for bug reports
and feature requests. You've got much better chances of getting your question answered on
StackOverflow where the community at large are looking
at questions tagged with ng-bootstrap
.
StackOverflow is a much better place to ask questions since:
To save your and our time we will be systematically closing all the issues that are requests for general support and redirecting people to StackOverflow.
We are always looking for the quality contributions! Please check the Contributing doc for contribution guidelines. Additionally, for local building and testing information, please see our Developer's Guide.
Please take a moment to read our Code of Conduct.