Ankit Kathait
Ankit Kathait

Reputation: 125

Unable to add bootstrap in angular

Hi I am using using Angular 5 and I am trying to import bootstrap in my code but unable to do so. I have installed bootstrap using:

npm install --save bootstrap

I have also add the css file to the .angular-cli.json as:

"styles": ["../node_modules/bootstrap/dist/css/bootstrap.min.css",
    "../node_modules/bootstrap/dist/css/bootstrap.css",
    "styles.css"
],

But when I inspect my code in google chrome what I get is this,

<!doctype html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <title>MyFirstApp</title>
      <base href="/">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="icon" type="image/x-icon" href="favicon.ico">
   </head>
   <body>
      <app-root></app-root>
      <script type="text/javascript" src="inline.bundle.js"></script><script type="text/javascript" src="polyfills.bundle.js"></script><script type="text/javascript" src="styles.bundle.js"></script><script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script>
   </body>
</html>

There is no styles for bootstrap in the header section. Please help me. I am stuck

Upvotes: 1

Views: 1174

Answers (3)

Nitin
Nitin

Reputation: 598

Try This, add your style bootstrap.min.css to style.css

@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";

Upvotes: 1

Mojtaba Nava
Mojtaba Nava

Reputation: 878

Add your style bootstrap.min.css to style.css main:

@import "../src/css/bootstrap.min.css";

Upvotes: 0

Digvijay ManeDeshmukh
Digvijay ManeDeshmukh

Reputation: 16

"./../node_modules/bootstrap/dist/css/bootstrap.css", ./../node_modules/bootstrap/dist/css/bootstrap.min.css",

use same like this

Upvotes: 0

Related Questions