Can not load data jsonp from url


#1

l have been stuck on this for a few days, feel like I’m missing something really simple.

Made a tabs ionic project and I need to pull data from a url spitting out JSONP.

Here’s what my RedditData.ts looks like:

import { Injectable } from ‘@angular/core’;
import { HttpClient } from ‘@angular/common/http’;
import ‘rxjs/add/operator/map’;

@Injectable()
export class RedditData {

constructor(public http: HttpClient) {
    console.log('Hello RedditData Provider');
}

getRemoteData(){
    var url = "v1/airport.json?code=BGW"
    this.http.get(url).map(res => res).subscribe(data => {
        console.log(data);
    });
}

}

when i runnig on local server i get message in console google chrome

failed GET /common/v1/airport.json?code=BGW& 418 ()

if l change

this.http.get

to

this.http.request

i get error Cannot read property ‘toLowerCase’ of undefined

see images

any help please .