I've been struggling with importing a JavaScript file into my Angular2 project. This particular file is not a module from npm, and the usual instructions using npm don't apply in this case.
My setup involves using Angular CLI, and within my angular-cli.json file, I have the following configuration:
{
"apps": [
"styles": [..],
"scripts": ["../pathtomyjs/file.js"]
]}
After running ng build and ng serve, I tested accessing the functions from my js file through the web console successfully by typing:
var test = MyObject;
This resulted in test being assigned an empty object {}.
However, when attempting to do the same in my component .ts file with:
let test = MyObject;
I encountered the error: home.component.ts (10,11): Cannot find name 'MyObject'.
I'm unsure about how to handle this situation in Angular2. Any advice would be appreciated!