npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ht-ng2-bootstrap

v1.0.25

Published

angular2 bootstrap components

Downloads

7

Readme

ng2-bootstrap npm version npm downloads

Native Angular2 directives for Bootstrap, works with Bootstrap 3 and 4-alfa

Follow me twitter to be notified about new releases.

Angular 2 Style Guide Build Status codecov slack Join the chat at https://gitter.im/valor-software/ng2-bootstrap Dependency Status NPM NPM Throughput Graph

Usage & Demo

http://valor-software.github.io/ng2-bootstrap/

If you need more modules check here

Starter packages

Hint: simpliest way to add styles is a CDN:

<!-- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

With system.js: angular2-quickstart

With webpack: AngularClass/angular2-webpack-starter

  • install ng2-bootstrap and typings for moment.js
  npm install ng2-bootstrap --save
  # Install typings from NPM. Ambient typings will not help
  typings install moment --save
  • add some code
  <!-- src/app/home/home.html -->
  <alert type="info">Hello from ng2-bootstrap  {{ date.toDateString() }}</alert>
  <div style="display:inline-block; min-height:290px;">
    <datepicker [(ngModel)]="date" showWeeks="true"></datepicker>
  </div>
  /* src/app/home/home.ts */
  import {AlertComponent, DATEPICKER_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
  ...
  @Component({
    directives: [
      ...
      AlertComponent, DATEPICKER_DIRECTIVES
      ]
  })
  export class Home {
    date: Date = new Date();
  }

With gulp and system.js: pkozlowski-opensource/ng2-play or mgechev/angular2-seed

  • hint: see quickstart section below for samples
  • just add link to ng2-bootstrap system.js bundle to index.html like in angular2-quickstart
  • and moment.js map in system.js configuration

Install from npm

npm i ng2-bootstrap --save

Install from CDN

Check cdnjs to include ng2-bootstrap as system.js bundle

<script src="https://cdnjs.cloudflare.com/ajax/libs/ng2-bootstrap/x.x.x/ng2-bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

Quick start

Hint: you can just clone angular2-quickstart

If you are following Angular2 5 min quickstart guide, just add one line

<!-- index.html -->
<script src="node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

As for now datepicker is using moment.js to format date, so please update system.js config to contain mapping:

<!-- index.html -->
  System.config({
    packages: {
      app: {
        format: 'register',
        defaultExtension: 'js'
      }
    },
    map: {
      moment: 'node_modules/moment/moment.js'
    }
  });

And update your app.component.ts to have following content:

import {Component} from 'angular2/core';
import {AlertComponent} from 'ng2-bootstrap/ng2-bootstrap';

@Component({
  selector: 'my-app',
  directives: [AlertComponent],
  template: `<alert type="info">ng2-bootstrap hello world!</alert>`
})
export class AppComponent {
}

And you are ready to go! :)

API

Check demo for API documentation

Contribution

Please read central ng2 modules readme for details, plans and approach and welcome :)

Credits

Crossbrowser testing sponsored by Browser Stack