3

How Twitter Bootstrap library is intended to use with Angular 2 framework? Basically I can think of two different ways

  • Write the html using Bootstrap containers and nest Angular components inside those containers, keeping Angular agnostic of the layout
  • Instruct Angular 2 to use Bootstrap as a stylesheet and build the template using Bootstrap containers

Which is easier, more refactorable and efficient way?

3
  • 2
    There is an ng2-strap Commented May 28, 2016 at 8:37
  • 2
    npm i ng2-bootstrap --save Commented May 28, 2016 at 8:40
  • Could you explain why I should favor ng2-bootstrap over just using Angular 2 with Bootstrap? Is it not possible to include Bootstrap in stylesUrl and start using it in template? Why we need Angular specific library? I ask because in industry we just can't depend on any arbitrary library. Commented May 28, 2016 at 12:08

1 Answer 1

0

You can integrate Bootstrap.css with Angular2 without no complications, there are many options for that (with CDN, manual import, with npm install ...), the problem here is that you also need to import Bootstrap.js and JQuery to make full use of the bootstrap framework.

You are working on a JS framework so you shold not depend on external JS libreries that can mess with your DOM management. Using ng-bootstrap you have components that angular can work with ( no need to import Bootstrap.js and JQuery), it is desing for angular.

Here is a link if you want to integrate them: angular2/5 with Bootstrap and ng-bootstrap integration

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.