Depois dessa aula, o meu extrato deixou de funcionar no browser.
import { TransferenciaService } from './../services/transferencia.service';
import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-extrato',
templateUrl: './extrato.component.html',
styleUrls: ['./extrato.component.scss'],
})
export class ExtratoComponent implements OnInit {
transferencias: any[] = [];
constructor(private service: TransferenciaService) {}
ngOnInit(): void {
this.transferencias = this.transferencias;
}
}
<table class="tabela">
<thead class="tabela__cabecalho">
<th class="tabela__cabecalho__conteudo">Data</th>
<th class="tabela__cabecalho__conteudo">Valor</th>
<th class="tabela__cabecalho__conteudo">Destino</th>
</thead>
<tbody *ngIf="!!transferencias?.length; else listaVazia">
<tr class="tabela__linha" *ngFor="let transferencia of transferencias">
<td class="tabela__conteudo">{{ transferencia.data | date: "short" }}</td>
<td class="tabela__conteudo">{{ transferencia.valor | currency }}</td>
<td class="tabela__conteudo">{{ transferencia.destino }}</td>
</tr>
</tbody>
</table>
<ng-template #listaVazia>
<p>Nenhuma transferência cadastrada</p>
</ng-template>