Dependencies

This repository contains a set of native Angular 2 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:

Installation

After installing the above dependencies, install ng-bootstrap via:

    npm install --save @ng-bootstrap/ng-bootstrap
  

Once installed, directives may be imported in several different ways:

For all the directives (if you simply intend on using everything):

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

Or, for specific component directives (using Alert as an example):

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

Once imported, add your chosen directives on your component's directives array property:

    directives: [
      ...
      NGB_DIRECTIVES,
      ...
    ]
  

Certain directives need to be precompiled in order to be used. This is done via your component's precompile array property. The following components require precompilation:

    precompile: [
      ...
      NGB_PRECOMPILE,
      ...
    ]
  

We recommend putting these in the top level component of your application. So ultimately, you should wind up having something that looks like this:

    import {Component} from '@angular/core';
    import {NGB_DIRECTIVES, NGB_PRECOMPILE} from '@ng-bootstrap/ng-bootstrap';

    @Component({
      selector: 'app',
      directives: [ NGB_DIRECTIVES ],
      precompile: [ NGB_PRECOMPILE ],
      templateUrl: './app.html',
    })
    export class App {
        ...
    }
  

Getting Help

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.

Contributing

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.

Code of Conduct

Please take a moment to read our Code of Conduct.