I am trying to include hello.js in my angular 5.0.2 project.
Below is the cli version

I added the script file to the angular-cli.json file.
"scripts": [
"./js/hello.js",
"./js/hello.polyfill.js",
]
The path is correct since I am also loading the style in angular-cli.json, which loads fine.
In my service file, I import hi, as shown below:
declare var hello: any;
declare var gapi: any;
but when I run ng build, the console will show an error:
Cannot find module 'hello'.
If I upload files through the script tag in index.html, the code and import work fine. Only when I add it to the angular-cli.json file does it stop working.
Please guide thanks
source
share