Upon receiving a message from my backend, it appears as follows:
[
[
{
"id": 1,
"date": "2018-12-31"
},
{
"id": 12,
"standard": null,
"capacity": 7,
"description": null,
}
],
[
{
"id": 26,
"date": "2018-12-08"
},
{
"id": 11,
"standard": null,
"capacity": 7,
"description": null,
}
]
]
To convert this response into a list of 2 objects, I have created the following class:
export class Response {
id: string;
date: string;
standard: string;
capacity: number;
description: string;
}
In my method, where I am calling a service, I have tried various approaches, but even using backendData.forEach does not work - Angular does not recognize backendData as an array.
getData(){
this.service.getData().subscribe(backendData=>{
//how to convert backendData to an array of Response[]?
})
}
I would greatly appreciate any assistance as I have been struggling with this issue for some time now.