ngFor only supports Iterables such as Array, so you cannot use it for Object.
Problem :
I keep getting this error and I don’t know what to do: ERROR Error: Cannot find a differ supporting object ‘[object Object]’ of type ‘object’. NgFor only supports binding to Iterables such as Arrays
There is nothing in the array. Hide the ngFor until after data is there.
Comment posted by Karim
how do i hide it?
Comment posted by Jorge Mussato
Can you
Comment posted by Karim
when i console.log it says Undefined
Comment posted by Karim
when i console.log it it shows [ ] @Aviad
Comment posted by Aviad
try to initialize the value with empty array and see if it solves the problem historique: Historique[ ] = [ ];
Comment posted by Aviad
can you post the returned value ? It seems you’re trying to access an object key inside an array. did you make sure you always get the keys date and description?
Comment posted by Karim
this is the data that i want to return [ { “id”: “482”, “dateInfec”: null, “idCitoyen”: “2952”, “description”: “en test”, “date”: “2020-11-01” }, { “id”: “483”, “dateInfec”: null, “idCitoyen”: “2952”, “description”: “neutre”, “date”: “2020-11-06” } ]
Comment posted by Aviad
try to console log the next thing and make sure you get the same result : “` this.serviceCovid.recupererHistorique(his.id).subscribe(histo => {this.historique = histo; console.log(this.historique)}) “`; validate the you array is stored properly.