The application I build at the moment runs in an angular 2.0.0 final
environment using typescript. Furthermore it uses the angular-cli 1.0.0-beta.15
.
As the whole application is produced by several different developers (all using typescript
) I get some .js
files that are compiled from typescript
and should be included and used in my angular 2 app.
My problem however is, that I can't seem to find a way to integrate the .js
file and use it in e.g. a component.
I allready checked this SO question as well as this question in the official repo but neither of these answers worked for me.
I even tried a workaround where I include the .js
file globally in the angular-cli.json
like this:
"scripts": [
"../path/to/custom.js"
]
How can I (generally and specifically for this scenario) include custom .js files which do not come as e.g. npm
module or have any d.ts
files.
EDIT:
The including itself by using the angular-cli.json
seems to work well but for now I still could not find a way to use the scripts methods. Whenever I do
declare var customJsObject: any;
It throws an
EXCEPTION: Uncaught (in promise):
Error: Error in CustomComponent caused by: customJsObject is not defined