JSON data
data:[
{
assets:[[tool_order_id: "38",order_status_id: "10"]],
order_info:[id: "1", order_type: "6",check: "1", current_Stage_id: "29"]
},
{
assets:[tool_order_id: "1",order_status_id: "10"],
order_info:[id: "2", order_type: "3",check: "1", current_Stage_id: "29"]
},
{
assets:[[tool_order_id: "8",order_status_id: "10"]],
order_info:[id: "3", order_type: "3",check: "1", current_Stage_id: "29"]
},
{
assets:[tool_order_id: "3",order_status_id: "10"],
order_info:[id: "4", order_type: "3",check: "1", current_Stage_id: "29"]
}
]
if I iterate this I am getting error. Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.the below is html
<div *ngIf="orders['assets'].length != 0">
<ion-row *ngFor="let tool of orders['assets']">
<ion-col col-4>{{ tool.tool_order_id }}</ion-col>
<ion-col col-4>{{ tool.order_status_id }}</ion-col>
</ion-row>
<div *ngIf="orders['assets'].length != 0">
<ion-row *ngFor="let tool of orders['assets']['0']">
<ion-col col-4>{{ tool.tool_order_id }}</ion-col>
<ion-col col-4>{{ tool.order_status_id }}</ion-col>
</ion-row>
and in data.ts file store the data in orders
this.orders = this.data; console.log(this.orders);
able to display the data in console.
[tool_order_id: "1",order_status_id: "10"]this is not valid JS array syntax. Are you sure you're dealing with an array and not an Object? - Dane Brouwer