hello every one i have this error ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables
i tried .json but it s not working in angular 9
My component .html
<div class="form-group">
<label for="">Ville</label>
<select class="form-control" #hh
(change)="getidregion(hh.value)">
<option></option>
<option *ngFor="let ville of dropDownList"
[value]="ville.id">
{{ville.nomVille}}
</option>
</select>
</div>
My Component.TS :
dropDownList: [];
responsable = {
id: 0,
nomResponsable: '',
prenomResponsable: '',
emailResponsable: '',
mdpResponsable: '',
img: '',
rib: '',
dtn: '',
region: 0,
ville: 0,
};
methodAPIToGetVilles() {
this.res.getville()
.subscribe((s: any) => {
this.dropDownList = s;
});
}
//methode to get the value off the idville in the option
getidville(id: any): void {
this.responsable.ville = id;
}
curUser: any = this.responsable[0];
My API Data :
"@context": "/api/contexts/Ville",
"@id": "/api/villes",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/api/villes/6",
"@type": "Ville",
"nomVille": "Davidboeuf"
},
{
"@id": "/api/villes/7",
"@type": "Ville",
"nomVille": "Benoitboeuf"
}];
{@context: "/api/contexts/Ville", @id: "/api/villes", @type: "hydra:Collection", hydra:member: Array(30), hydra:totalItems: 403, …} @context: "/api/contexts/Ville" @id: "/api/villes" @type: "hydra:Collection" hydra:member: Array(30) 0: {@id: "/api/villes/6", @type: "Ville", nomVille: "Davidboeuf"} 1: {@id: "/api/villes/7", @type: "Ville", nomVille: "Benoitboeuf"}
– Abdeljabbar El Mediouni