Hello,
I search for the possibility to ask if a http response type is text or json?
Hello,
I search for the possibility to ask if a http response type is text or json?
i think it sent array of object.you can accesss
return this.http.get(url).subscribe(data=> {
console.log(data[‘object_name’]);
})
Use Angular’s HttpClient.
okay above code also working for HttpClient.
in code above http is the reference variable of HttpClient.
export class Service {
constructor(private http:HttpClient) {
}
fetchData () {
return this.http.get(url).subscribe(data=> {
console.log(data[‘object_name’]);
})
}
}