【问题标题】:why is bootstrap not running in my new angular application为什么引导程序没有在我的新 Angular 应用程序中运行
【发布时间】:2021-12-28 00:43:03
【问题描述】:

所以在开始一个全新的 Angular 项目后,我做了一个 npm install of bootstrap。在我的 node_modules 中看到它之后,我将它放在我的 angular.json 中。

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

我目前正在使用应该在引导程序中工作的类的示例代码,但是当它们显示在屏幕上时,它们缺少引导程序样式。我错过了什么?

【问题讨论】:

    标签: angular bootstrap-4


    【解决方案1】:

    您可能也使用了需要引导 js 的功能,因此您还需要在 projects->architect->build-> 中添加 => "/node_modules/bootstrap/dist/js/bootstrap.js"脚本数组。 如果不是这种情况或不起作用,您可以尝试另一种方法,即直接在 style.css 中导入 css 文件:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-23
      相关资源
      最近更新 更多