首页 > 解决方案 > 不知何故,我的 bootstrap 和 jquery 文件拒绝在 Angular 项目中加载

问题描述

我在我的 Angular 项目中通过以下命令安装了引导程序

 npm install --save bootstrap jquery
  "styles": [
  "../node_modules/bootstrap/scss/bootstrap.scss",
  "styles.scss"
]

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

问题是 sass 文件在我将它导入到 sass 文件之前才起作用,这意味着我的 angular.json 配置不起作用

@import "~bootstrap/scss/bootstrap.scss";// this worked

请提供任何帮助,因为我已经在它工作的其他项目中使用它,而在其他项目中它不起作用。我想知道做错了什么。

标签: javascriptangulartwitter-bootstrap

解决方案


使用这种方法

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

推荐阅读