Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 : Scripts not loading correctly from angular.json

I have not found yet the solution of this in the internet.

Angular brought this similar Github Issue , but can't find any solution there.

I have added my script files to angular.json such as (in both build & test scope):

        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "src/styles.css"
        ],
        "scripts": [
          "src/assets/plugins/jquery/jquery-1.11.3.min.js",
          "src/assets/plugins/jquery-ui-1.11.4.custom/jquery-ui.min.js",
          "src/assets/plugins/bootstrap/js/bootstrap.min.js",
          "src/assets/plugins/owl-carousel/owl.carousel.min.js",
          "src/assets/plugins/bootstrap-select/js/bootstrap-select.min.js",
          "src/assets/js/jquery.subscribe-better.js",

          "src/assets/js/moment-with-locales.min.js",
          "src/assets/plugins/countdown/jquery.plugin.min.js",
          "src/assets/plugins/countdown/jquery.countdown.min.js",
          "src/assets/js/theme.js"
        ]

I am getting the css styles but some scripts are not working correctly.

Any solution?

like image 893
Fahim Uddin Avatar asked Nov 18 '22 06:11

Fahim Uddin


1 Answers

After a couple of hours of trial-and-error, I found out that I was putting the script paths under the json key of

/projects/project-name/architect/test/options/scripts

instead of (if not both)

/projects/project-name/architect/build/options/scripts

P.S.: It may also apply to the "styles.css not working" type of questions.

like image 102
yahyatoraman Avatar answered Dec 15 '22 15:12

yahyatoraman