I have been adding my javascript files this way in angular:
"scripts": ["src/assets/js/core/jquery.min.js",
"src/assets/js/core/bootstrap-material-design.min.js",
"src/assets/js/plugins/moment.min.js",
"src/assets/js/core/popper.min.js"],
is there another method to add external javascript files to angluar 7 besides this one. I tried this but it doesnt seem to have any effect
first, you should install your library with npm. then the library is being added to your node_modules folder, in your project.
now:
if you want to import js files into the angular project, first you should check the version of angular, if you are using version 2 and 4 , you should write like this :
"scripts": [ "../node_modules/jquery/dist/jquery.min.js" ]
and if you are using version upper than 4, like 5,6 or 7 you should write like this :
"scripts": [ "./node_modules/jquery/dist/jquery.min.js" ]
in this example i import jquery into the angular project. i hope, it works
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.