【发布时间】:2018-09-27 12:33:51
【问题描述】:
我正在使用 angular 6 和 sass bootstrap 项目,我正在尝试在 angular.json 中添加 jquery、popper 和 js
我在 angular.json 中的代码是:
"styles": [
"src/styles.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/popper.js/dist/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
]
我也试过这个:
"styles": [
"src/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/popper.js/dist/popper.js",
"./node_modules/bootstrap/dist/js/bootstrap.js"
]
但切换和下拉菜单对我不起作用。
【问题讨论】:
-
只添加script标签下的css文件
-
不起作用。我需要添加脚本依赖项以使一切正常
-
你是否停止并再次运行
ng serve进行编译? -
我做了但没用。在 Angular 6 中添加 js 的最佳方法是什么?