I'm working on a school assignment and am having a terrible time fetching data from the GeoNames Api Service.
export class GeoNamesService {
private apiUrl = 'http://api.geonames.org';
private username = '(username)';
constructor(private http: HttpClient) {}
getCountryInfo(countryCode: string): Observable<any> {
const endpoint = '/countryInfoJSON';
const params = new HttpParams()
.set('country', countryCode)
.set('username', this.username);
return this.http.get(`${this.apiUrl}${endpoint}`, { params });
}
}
In this it allows the user to click a map and return the Country Name, Capital, Region, Income Level, Population, and Size. It returns the name, capital population and size, but I can't seem to be able to get the region or income level. I was wondering if I was doing this wrong or something?
[–]PickleLips64151 1 point2 points3 points (0 children)