javascript - Relatives and absolute url when doing http.get in angular -
i'm new angular , it's being hard work things. i'm using latest angular ( version 4 ). have scenario :
- my backend rest services in
baseurl/contextws
- my angular application in
baseurl/contextfront
- the base tag href attribute pointing /contextfront
- both angular application , backend in same server (baseurl)
- the angular application embedded in iframe (because referenced application) .
now lets want call baseurl/contextws/myservice
angular application. how can ?
i can't this.http.get('/contextws/myservice')
because angular app translate baseurl/contextfront/contextws/myservice
wrong.
i tried build url :
var url 'http://' + location.host +':' + location.port + '/contextws/myservice'; this.http.get(url);
this works in application, when app referenced in iframe gives me error "undefined".
any appreciated.
Comments
Post a Comment