0
I have an array with the user data, which is the data that it hit point on that date that ta in the array. array:
[
0:{CCT: "150403",CODIGO_EVENTO: "012",COLABORADOR: "FULANO",DATA: "20190110",DESCRICAO: "ATRASO AUTORIZADO", FILIAL: "01",MATRICULA: "000457", QUANTC: 0.24},
1:{CCT: "150403",CODIGO_EVENTO: "013",COLABORADOR: "FULANO",DATA: "20190110",DESCRICAO: "ATRASO ", FILIAL: "01",MATRICULA: "000457", QUANTC: 0.24},
2:{CCT: "150403",CODIGO_EVENTO: "013",COLABORADOR: "FULANO",DATA: "20190110",DESCRICAO: "ATRASO AUTORIZADO", FILIAL: "01",MATRICULA: "000457", QUANTC: 0.30},
3:{CCT: "150403",CODIGO_EVENTO: "012",COLABORADOR: "FULANO",DATA: "20190111",DESCRICAO: "ATRASO AUTORIZADO", FILIAL: "01",MATRICULA: "000457", QUANTC: 0.31},
4:{CCT: "150403",CODIGO_EVENTO: "012",COLABORADOR: "FULANO",DATA: "20190111",DESCRICAO: "HORA EXTRA AUT. 50% ", FILIAL: "01",MATRICULA: "000457", QUANTC: 0.20}
]
There in HTML it is like this:
<div *ngFor="let dados of dadosColab">
<p class="text-light "><span class="text-warning">DATA:</span> {{formatDate(data)}} </p>
<p class="text-light"><span class="text-warning">QTDE. CALCULADA:</span> {{QUANTC}} </p>
<p class="text-light"><span class="text-warning">DESCRIÇÃO:</span> {{descri}} </p>
</div>
then appears:
DATA: 20190110
dados...
DATA: 20190110
dados...
only that I need you to show only once the date, so:
DATA: 20190110
reg1
reg2
reg3
DATA: 20190111
reg1
reg2
and so on, without repeating the date. Is there a way to do this by yourself *ngFor or by tinkering with the array? I’m lost in this problem
Hello. You will have to group the records based on the dates. Here’s an article explaining how to do this with a PIPE: https://www.competa.com/blog/custom-groupby-pipe-angular-4/
– Gesiel Rosa