I realize that the new updates don't require conversion of a response to JSON.
The tutorial I am following puts this into the api.service.ts
export class ApiService {
constructor(private http: HttpClient){}
messages = []
getMessage(){
this.http.get('http://localhost:3000/newroute').subscribe(res =>{
this.messages = res.json()
})
}
}
However, with the new update, "res.json()" does not work. I get the following error: Property 'json' does not exist on type 'Object'.
How can I solve this?
Here is the data I'm trying to loop through:
var posts = [
{message:'Hello World'},
{greeting:'Whats going on'}
]