Can't read property 'name' of undefined


Haiii. I am the new one to ionic as well as angular. For practice, I am developing an ionic3 app. My app contains a service page “countries.service.ts” which reads countries details form the URL using HTTP. And my home page get the data from the “CountriesService”. But i am getting the error “Can’t read property ‘name’ of undefined”…
In home.html I am trying to read the values like this.:



this.countriesService.getCountryDetail().subscribe(res => this.countryObj= res.json()[0]);
public getCountryDetail(){
let url:string=‘’;
return this.http.get(url);
Thanks in advance…


can you please describe?


Thanks for reply… My countries.service.ts service should get json data of different countries from the url mentioned above. My home.ts file should read the data returned by the**countries.service.ts**