我想知道是否有一种动态的方式来获取基本网址,以便在http请求中使用?
有没有办法动态获取http://192.123.24.2:8080?
public getAllTickets() { this._http.get('http://192.123.24.2:8080/services/',{ method: 'GET',headers: new Headers([ 'Accept','application/json','Content-Type','application/json' ]) })
所以,我的请求看起来像:
public getAvailableVersions() { this._http.get('../services','application/json' ]) })
我正在寻找一种不必硬编码REST调用URL的方法.或者是具有URL的全局变量的唯一选择?
谢谢!