Angular 6添加jquery,popper和bootstrap js

时间:2018-09-27 12:33:52

标签: angular twitter-bootstrap

我正在使用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"
        ]

但是对我来说,切换和下拉菜单不起作用。

1 个答案:

答案 0 :(得分:1)

 npm install bootstrap to install boostrp
 npm install jquery to install jquery and add path under the 'build' inside 
 angular.json

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

Please verify the file inside the node_modules.