0

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 .

4
  • 1
    add only the css files under script tag Commented Sep 27, 2018 at 12:35
  • 1
    doesn't work . i need to add scripts dependencies to make everything work Commented Sep 27, 2018 at 12:40
  • 1
    did you stop and run again ng serve to compile? Commented Sep 27, 2018 at 12:42
  • 1
    i did but doesn't work. whats the best way to add js in angular 6 ? Commented Sep 27, 2018 at 12:50

1 Answer 1

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.
Sign up to request clarification or add additional context in comments.

5 Comments

this my current version : "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" ]
please provide your angular.json file
As per your json file there is no "styles": [ "src/styles.scss" ], "scripts": [ "node_modules/bootstrap/dist/css/bootstrap.min.css" ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.