I got simple service
getHotels(): Observable<any> {
return this.http.get(API_URL + '/hotels');
}
and in my component I got
getHotels() {
this.workersService.getHotels().subscribe(
res => {
this.hotels = res;
console.log(this.hotels);
},
error => {
console.log(error);
}
);
}
and output from console.log
is
[{…}]
0: {id: 1, id_hotel: "123", client: "test", date: "17.08.2020", team: 1, …}
length: 1
__proto__: Array(0)
And I got acces by for example this.hotels[0].client
but I want this.hotels.client
How Can I get just object instead of array of objects?