Is there a correct way to invoke a JavaScript function from a component in Angular 2 (TypeScript) ?
Here is my component :
import { ElementRef, After
You have to tell TypeScript about external (JavaScript) declarations using declare
. See https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
interface MyTheme {
documentOnLoad: Function;
documentOnReady: Function;
}
declare var MYTHEME: MyTheme;
Or anonymously
declare var MYTHEME: {documentOnLoad: Function, documentOnReady: Function};