I am developing an angular4 application. My Component.ts looks like:
ngOnInit() {
this.http.get('http://localhost:4000/data/').subscribe(data => this.temp = data);
// this.temp1 = JSON.parse(this.temp)
console.log(this.temp)
}
On the console I am getting 'undefined' for this.temp
Responseand typecast inside themap- Aravindhttpservice you don't need to calljson()any more. It's decoded automatically, see angular.io/guide/http#typechecking-the-response - martin