0
I need to list all subcategories in a table and I’m not sure how to do this.
{
"message": [
{
"category_id": 1,
"shop_id": 1,
"category_name": "Bebidas",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": [
{
"sub_category_id": 1,
"category_id": 1,
"sub_category_name": "sucos",
"datecreate": "2019-02-04 18:57:25",
"dateupdate": "2019-02-04 18:57:25",
"status": 1
},
{
"sub_category_id": 6,
"category_id": 1,
"sub_category_name": "refrigerante",
"datecreate": "2019-02-04 19:23:17",
"dateupdate": "2019-02-04 19:23:17",
"status": 1
}
]
},
{
"category_id": 2,
"shop_id": 1,
"category_name": "Pratos",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": [
{
"sub_category_id": 2,
"category_id": 2,
"sub_category_name": "individuais",
"datecreate": "2019-02-04 18:57:25",
"dateupdate": "2019-02-04 18:57:25",
"status": 1
}
]
},
{
"category_id": 3,
"shop_id": 1,
"category_name": "Porções",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": [
{
"sub_category_id": 4,
"category_id": 3,
"sub_category_name": "completa",
"datecreate": "2019-02-04 18:57:59",
"dateupdate": "2019-02-04 18:57:59",
"status": 1
}
]
},
{
"category_id": 4,
"shop_id": 1,
"category_name": "Entradas",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": [
{
"sub_category_id": 3,
"category_id": 4,
"sub_category_name": "salada",
"datecreate": "2019-02-04 18:57:59",
"dateupdate": "2019-02-04 18:57:59",
"status": 1
}
]
},
{
"category_id": 5,
"shop_id": 1,
"category_name": "Sobremesas",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": [
{
"sub_category_id": 5,
"category_id": 5,
"sub_category_name": "doces",
"datecreate": "2019-02-04 18:58:14",
"dateupdate": "2019-02-04 18:58:14",
"status": 1
}
]
},
{
"category_id": 14,
"shop_id": 1,
"category_name": "Cafés",
"status_cat_css": 0,
"status_cat_active": 1,
"sub_categories": []
}
],
"count": 6,
"error": false,
"statuscode": 200
}
<tbody>
<tr *ngFor="let item of listSubCateg">
<td>{{item.sub_category_name}}</td>
<td>{{item.category_name}}</td>
</tr>
</tbody>
And what is the difficulty?
– LeAndrade
@Leandrade, I want to list all subcategories, this way how I am running ngFor, is not bringing any...
– Henrique Mendes Silveira Rodri