Pedro Romano Barbosa Pedro Romano Barbosa - 1 month ago 19
TypeScript Question

Import Bootstrap styles in Angular 2

How do I import bootstrap into my angular 2 project? I have the bootstrap package in the nod_modules directory.
I do this in a component file:

import { Component } from '@angular/core';
import 'bootstrap';


But the page gets stuck in the loading...

Answer

Put this lines in you main html to install:

<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">

If you want use it in your component:

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

This is de complete documentation for ng2-bootstrap: https://github.com/valor-software/ng2-bootstrap