0
My ngFor not showing all the data that arrives, but in the console shows all the results.
I pull some data from the API and it has a sales and meta data, they come in an array and I use the foreach in them, and if it reached the goal it should go to another array:
this.MetaService.FiliaisMetaDiarias().subscribe(
data => {
const response = (data as any)
this.objeto_retorno = JSON.parse(response._body);
this.objeto_retorno.forEach(element => {
this.tots = element.TOTAL
if (this.tots >= this.MetaAtingida) {
this.fil = [
{
FI: element.FILIAL,
porc: element.TOTAL
}
]
this.fil.forEach(elements => {
this.mainColor = 'MetaAtingida'
})
}
Then I play in html:
<p [class]="mainColor + ' teste'" *ngFor="let elements of fil" >Filial {{ elements.FI }} = {{ elements.porc }}</p>
It should show all the results, but for some reason it is showing only the last data, but in the console it shows all the data.
Can someone help me?
Is there a way you put the code of your service that makes this call? Where is this console in your code that shows the data?
– Eduardo Vargas