I have the next issue in angular:
I have this json as entity:
{
"id": 1,
"value": "I am ok"
}
I have my own model as json like :
[{
"Field": "id",
"ReadOnly": true,
"BackColor": "silver",
"Type": "Text"
},{
"Field": "value",
"ReadOnly": true,
"BackColor": "silver",
"Type": "Text"
}]
Once I get the correct information in the subscription (first json I showed you), I am making, in the template of the component, a loop of model to configure the dialog and I am using matInput to show the values.
Ok I am trying to build something like:
<div *ngFor="let col of row.data" class="col-{{col.ColType}}-{{col.Col}}" [ngSwitch]="col.Type" style="width: 100% !important">
</div>
row.data is each col of the model converted to array.
Inside div I am making something like:
<mat-form-field *ngFor="let data of classe.Data">
<input matInput [(ngModel)]="data[col.Field.toLowerCase()]" [name]="col.Field.toLowerCase()" >
</mat-form-field>
classe.Data is the class of first json I wrote.
I am getting the next error:
core.js:7187 ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
Do I have other way to avoid this error? I would like to use ngModel but if not possible I am open to use other way.
Thx
idand one for thevalue? - nash11