Click here to access JSON data from maps.googleapis.com containing latitude and longitude information.
I am looking to parse this JSON data using Typescript and Angular2.
I have attempted various solutions provided by Google as well as the code snippet recommended by Angular on this page:
private extractData(res: Response) {
let body = res.json();
return body.data || {};
}
// This function is triggered when clicking on the map and successfully captures latitude and longitude values
getLongLatClick($event: any) {
this.lat = $event.coords.lat;
this.lng = $event.coords.lng;
this.url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='+this.lat+','+this.lng+'';
console.log(this.http.get(this.url).map(this.extractData));
However, upon debugging in Chrome, it appears that the "extractData" method is not being executed. It seems like the googleapis link may not actually be providing JSON data for some reason.
What steps should I take in order to properly read the JSON data?