简体   繁体   中英

Add bootstrap and jQuery to Angular 8

I'm new to Angular. I'm trying to add bootstrap and jquery to my first project. I run this code on my project dir npm install bootstrap@3 jquery --save

It was run perfectly and added jquery and bootstrap to node_modules folder. And these lines can see under the dependencies in package.json

 "bootstrap": "^3.4.1",
 "jquery": "^3.4.1",

Then parts were added to the styles and scripts in the angular.json file.

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

But Case is Bootstrap not work for the views

      <form >
          <div class="form-group">
            <label for="email">Email address</label>
            <input type="email" class="form-control" name="email" placeholder="Enter email" >
          </div>
          <div class="form-group">
            <label for="password">Password</label>
            <input type="password" class="form-control" name="password" placeholder="Password" >
          </div>
          <button type="submit" class="btn btn-success">Sign in!</button>
        </form>

Output->

在此处输入图片说明

Could I know the mistake I have done?

将此添加到您的styles.css

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM