Looking at my JSON data structure, here's what it looks like:
{"id":1,"category":"cat","iconUrl":"www.test.com","subCategoryEntity":[{"id":3,"subCategory":"sub3","products":[]},{"id":2,"subCategory":"sub2","products":[]},{"id":1,"subCategory":"sub1","products":[{"id":1,"fileDownloadUri":"http://localhost:8081/api/v1/downloadFile/paint-bucket-orange-2-300x300.jpg","productName":"Name","productPrice":20.0,"productDesc":"this is the discreption","productStock":15,"productImages":[]}]}]}
https://i.sstatic.net/6CQab.png
My task is to loop through each subcategory and retrieve all the products within that subcategory.
Below is the Angular code I am using:
<div *ngFor="let item of allProducts| keyvalue">
{{item.key}}:{{item.value}}
</div>
And here is the resulting output: https://i.sstatic.net/3R2Ps.png