简体   繁体   English

添加到项目后,引导程序无法在 Angular 11 上运行

[英]Bootstrap isn't working on Angular 11 upon adding to the project

I am trying to use bootstrap 4.6 on angular 11, I have done following steps.我正在尝试在 angular 11 上使用 bootstrap 4.6,我已经完成了以下步骤。

  1. It was installed and listed under the package as "bootstrap": "^4.6.0"它已安装并在 package 下列为"bootstrap": "^4.6.0"

  2. Listed bootstrap inside angular.json under styles :angular.json下的styles列出了引导程序:

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

    Still its not loading bootstrap仍然没有加载引导程序

  3. Tried changing directory as in ./node_modules or ../node_modules or node_modules nothing works.尝试更改目录,如./node_modules../node_modulesnode_modules没有任何效果。

  4. used import bootstrap in style file it works fine but why its not working when I declared it in angular.json .在样式文件中使用 import bootstrap 它工作正常,但为什么当我在angular.json声明它时它不起作用。

Please let me know what I do wrong.请让我知道我做错了什么。

You can define different named build configurations on your angular.json, are you including the "styles" inside "build" and "serve" sections?您可以在 angular.json 上定义不同的命名构建配置,您是否在“构建”和“服务”部分中包含“样式”? Also can you see the physical css file on your filesystem?您还可以在文件系统上看到物理 css 文件吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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