I have a JSON file on the server. I want to load it in my angular-typescript. I tried the following.
ngOnInit () {
this.httpService
.get("http://x.x.x.x/config_files/test/config.json")
.subscribe(data => console.log(data));
}
I'm getting the following error when I refresh a page
Access to XMLHttpRequest at 'http://x.x.x.x/config_files/test/config.json' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Since there is no server-side API the header Access-Control-Allow-Origin cannot be added. How to fix the issue?