Sunday, 3 November 2019

How to add Bootstrap to angular application?


Run the below command in command prompt

npm install --save bootstrap@3

Add in angular.json file the bootstrap reference in styles array
"styles"  [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],

We can also use styles.css file present in project folder to call the bootstrap and other third party css libraries as below:

@import "~bootstrap/dist/css/bootstrap.css";

@import "~font-awesome/css/font-awesome.css";

body { padding-top: 80px; }



Run the angular application and open the developer tool by pressing F12 and see the bootstrap reference in Element Tab.



No comments:

Post a Comment