[英]Bootstrap not working in Angular 6 app
I want to make use of Bootstrap in an Angular 6 app and here is what I have done so far but nothing seems to be working out: 我想在Angular 6应用程序中使用Bootstrap,这是我到目前为止所做的,但似乎没有任何工作:
1) Installed bootstrap, jquery and popper.js using npm. 1)使用npm安装bootstrap,jquery和popper.js。 2) Entered the following in the Angular.json file 2)在Angular.json文件中输入以下内容
"styles": [
"src/styles.scss",
"node_modules/bootstrap/scss/bootstrap.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.slim.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"
...
]
Am I missing something. 我错过了什么。 This doesn't seems to work out. 这似乎没有成功。
in your style.scss
files use import
在你的style.scss
文件中使用import
@import "node_modules/bootstrap/scss/bootstrap.scss"
and remove "node_modules/bootstrap/scss/bootstrap.scss"
from angular.json
file 并从angular.json
文件中删除"node_modules/bootstrap/scss/bootstrap.scss"
First install bootstrap to the App: 首先在App上安装bootstrap:
npm install bootstrap@latest --save (flag is optional)
Then import the bootstrap to the index.html file in Angular: 然后将引导程序导入Angular中的index.html文件:
@import '~bootstrap/css/bootstrap.css'; (~ means the node_Modules)
I hope this answers your question. 我希望这回答了你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.