It would be nice to have a "global" JavaScript file where the URLs of the rest services are defined. At the moment, in every js file are all rest URLs defined...
It would be nice to have a "global" JavaScript file where the URLs of the rest services are defined. At the moment, in every js file are all rest URLs defined...
You can use Setting service to define such things. Settings service is pretty much works like a property file:
Then use it in the service for URL or request parameters:
{url}
How can you make a service URL come from local storage variable?
In the service, define the URL to be {url}. Then, create a request parameter called 'url'.
When you do mapping for this parameter, in JavaScript run this:
localStorage.getItem('url');