I need help. I'm working on an Angular project. I'm making some API calls (GET/PUT) to a remote server. To save time and prformance of my application I thought let's keep it in my local itself. So, I downloaded the JS file and kept it in assets folder.
Previously the code was:
private loadMySisenseJs(): Promise<any> {
...
// load required js
this.sisenseJsLoadPromise = new Promise((resolve, reject) => {
const sisenseJsSrc = 'https://sisense-dev.dummy.com/js/sisense.js'; // FROM SERVER
...
});
return this.sisenseJsLoadPromise;
}
}
Now the code is:
private loadMySisenseJs(): Promise<any> {
...
// load required js
this.sisenseJsLoadPromise = new Promise((resolve, reject) => {
const sisenseJsSrc = '../../../assets/sisense.js'; // FROM LOCAL
...
});
return this.sisenseJsLoadPromise;
}
}
I tried these things also:
1. index.html
<script type="text/javascript" src="path-to-javascript-file.js"></script>
angular.json
"scripts": [
...
"(local path to js file)/sisense.js"
]
But still the same problem. Please help me.