I am trying to access a specific array within an object from a JSON file. Here is the snippet of the data I'm dealing with:
best-sellers": [
{
"title": "Chuteira Nike HyperVenomX Proximo II Society",
"price": 499.90,
"installments": {
"number": 10,
"value": 49.90
},
"high-top": true,
"category": "society",
"image": ""
},
{
"title": "Chuteira Nike HyperVenom Phantom III Cano Alto Campo",
"price": 899.90,
"installments": {
"number": 10,
"value": 89.90
},
"high-top": true,
"category": "campo",
"image": ""
}
}
]
This is how my component code looks like:
ngOnInit(): void {
this.service
.lista()
.subscribe(chuteiras =>{
this.chuteiras = chuteiras;
})
}
and in my template, I have written:
<div *ngFor="let chuteira of chuteiras.best-sellers">
However, Angular does not seem to recognize `best-sellers" and it throws the following error:
Cannot read property 'best' of undefined