Search code examples
angularangular-httpclient

Angular httpclient not use absolute url


I use Angular 7 and HttpClient:

import { HttpClient, HttpHeaders, HttpResponse, HttpRequest, HttpParams } from '@angular/common/http';

...

this.http.get(this.appConfigService.apiUrl + url, {headers: this.getHeaders(),  params: urlParams} )

this.appConfigService.apiUrl contain : https//xxxx-api.eu-west-3.amazonaws.com:80/int/

But my ajax call is http://localhost:4200/https//xxxx-api.eu-west-3.amazonaws.com:80/int/meeting

How to not use http://localhost:4200/ at the at the beginning of url?


Solution

  • You are missing a colon in your url after https

    https//xxxx-api.eu-west-3.amazonaws.com:80/int/

    should be

    https://xxxx-api.eu-west-3.amazonaws.com:80/int/