Angular 2 - Dynamically find base url to use in the http requests (services)
<p>I'm wondering if there is a dynamic way of getting the base url, to use in the http requests?</p>

<p>Is there any way of getting the <strong><a href="http://192.123.24.2:8080" rel="noreferrer">http://192.123.24.2:8080</a></strong> dynamically?</p>

<pre><code>public getAllTickets() {
    this._http.get('http://192.123.24.2:8080/services/', {
        method: 'GET',
        headers: new Headers([
            'Accept', 'application/json',
            'Content-Type', 'application/json'
        ])
    })
</code></pre>

<p>So, I my request would look something like:</p>

<pre><code>public getAvailableVersions() {
    this._http.get('../services', {
        method: 'GET',
        headers: new Headers([
            'Accept', 'application/json',
            'Content-Type', 'application/json'
        ])
    })  
</code></pre>

<p>I'm looking for a way to not having to hard code the URL for the REST calls. Or is the only option to have a global variable with the URL?</p>

<p>Thanks!</p>