I have an angular 6 application running inside a Spring Boot app.
Is it possible to get parameters from the spring boot app inside the angular app?
Why? The spring app has a REST service that provide the config to the angular app (I cannot use the environment.ts file since the config is dynamic and will explain in a bit). But I do not know how to call the spring REST service from angular.
If I use http://localhost:80/MyRestURL
the angular app will try to make a call to localhost but localhost from the browser will refer to the PC that I am launching the browser from. I need to go to the server that the app is running on.
Now I could go and grab the hostname from the url as described here.
let hostNameFromURL: string = this.window.location.hostname;
let correctLocalServerURL: string = "http://" + hostNameFromURL+ ":80/MyRestURL";
But if we launching the angular app from a load balancer the name in the URL would be the load balancer's URL and not the server that the Spring Boot App and Angular is running from. I could fetch the config via the load balancer but it seems counter productive to reference another machine (that might be unstable) if the user has already been routed to a server that works).
Is there another way to share data between angular and the spring boot app?