I want to use the global variable cwic declared in an external js library in the app.component.ts file. The js library in kept in the assets folder as cwic-debug.js. Now to initialize the library and use the cwic variable the statement SystemController method must be called as-
cwic.SystemController.initialize()
index.html
<script type="text/javascript" src="./assets/cwic-debug.js"></script>
I have tried initializing the cwic library in the following manner-
app.component.ts-
export class AppComponent implements AfterViewInit{
ngAfterViewInit(){
cwic.SystemController.initialize();
console.log(cwic);
}
title = 'Angular Project';
}
But since cwic variable in not recogized it throws up an error and underlines the cwic word in red.
The js library i.e. cwic-debug.js looks something like this-
var cwic =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
How can I use this cwic variable in app.component.ts file?