how can I import a js file in angular 6. I tried to implement a navbar and it contains js functions. thanks!!!
I Add my js file called nav.js
\"scripts
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