简体   繁体   中英

Angular 6 add jquery, popper and bootstrap js

I'm working with angular 6 and sass bootstrap project and i'm trying to add jquery, popper and js in angular.json

My code in angular.json is :

"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"
        ]

i have tried this also :

 "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"
        ]

but toggle and dropdown dosnt work for me .

 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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