引导版本3.4在Angular 9中不工作
我已经使用Angular cli安装了引导版本3.4。下面是我使用的命令 npm安装--保存bootstrap@3 然后我补充说引导版本3.4在Angular 9中不工作,angular,twitter-bootstrap-3,Angular,Twitter Bootstrap 3,我已经使用Angular cli安装了引导版本3.4。下面是我使用的命令 npm安装--保存bootstrap@3 然后我补充说 "styles": [ "./node_modules/bootstrap/dist/css/bootstrap.min.css", "src/styles.css" ], "scripts": [ "./node_modules/bootstrap/dist/js/boots
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": [
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
]
在angular.json文件中。
但是我无法访问引导默认样式类。每当我运行应用程序时,浏览器控制台中都不会显示引导文件
我在这里找不到问题。非常感谢你的帮助。
添加my node_模块文件夹的屏幕截图
您的路径不应以
/
开头
相反,请尝试以下操作:
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.min.js"
]
这将使它们相对于项目根
工作演示:删除相对路径,如下所示。正如src直接使用一样,使用node_模块而不是。/node_模块
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
一个好的资源链接是
添加
@import "~bootstrap/dist/css/bootstrap.css";
到src/styles文件。这是否回答了您的问题?我也尝试过这个,但也不起作用。你导航到mode_modules文件夹以确保文件在那里吗?是的,我也检查过。你尝试过在更新这些路径后重建应用程序吗?是的,我这样做了。