FlightAware CORs error with Angular 5


The error I’m getting is:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

Here is my code:

 constructor(private _http: HttpClient) { }

  getFlights(): Observable<any> {
    return this._http.get<any>(this._siteURL)
      .do(data => console.log('All: ' + JSON.stringify(data)))

  private handleError(err: HttpErrorResponse) {
    console.log('SearchFlightsService: ' + err.message);
    return Observable.throw(err.message);

I am confused as to why this is not working as it does on Postman.
“airports”: [
“fs”: “JFK”,
“iata”: “JFK”,
“icao”: “KJFK”,
“faa”: “JFK”,
“name”: “John F. Kennedy International Airport”,
“street1”: “JFK Airport”,
“city”: “New York”,
“cityCode”: “NYC”,
“stateCode”: “NY”,
“postalCode”: “11430”,
“countryCode”: “US”,
“countryName”: “United States”,
“regionName”: “North America”,
“timeZoneRegionName”: “America/New_York”,
“weatherZone”: “NYZ178”,
“localTime”: “2017-11-17T09:37:34.462”,
“utcOffsetHours”: -5,
“latitude”: 40.642335,
“longitude”: -73.78817,
“elevationFeet”: 13,
“classification”: 1,
“active”: true,
“delayIndexUrl”: “https://api.flightstats.com/flex/delayindex/rest/v1/json/airports/JFK?codeType=fs”,
“weatherUrl”: “https://api.flightstats.com/flex/weather/rest/v1/json/all/JFK?codeType=fs

Please help!


You may need support from FlightStats, or you can grab a key from https://flightaware.com/commercial/flightxml/ and we would be more than happy to assist with any issues you are having.