This is a scenario where a parent component calls a dataservice to retrieve data. The component defines columns for a table:
tableInterventionsColumns: TableColumn<Interventions>[] = [
{
label: 'Date',
property: 'dateIntervention',
type: 'text'
},
...
];
The component also fetches data from the dataservice and stores it in an array:
tableInterventionsData: Interventions[];
.........
this.TankDetailsService.getInterventions(this.idCit).subscribe((Interventions: Interventions[]) => {
this.tableInterventionsData = Interventions;
});
Both arrays can be viewed in the console.
The template includes a child component that receives the data as input:
<vex-widget-table-interventions [columns]="tableInterventionsColumns"
[data]="tableInterventionsData"
class="w-full overflow-auto shadow" gdColumn="3 / -1"
gdColumn.lt-md="1 / -1"
gdColumn.lt-sm="1"></vex-widget-table-interventions>
The child component is responsible for creating a datatable using the provided arrays:
import { AfterViewInit, Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
...
Although the columns are fetched correctly, there seems to be an issue with retrieving the data. Any suggestions or ideas on how to resolve this issue would be appreciated, especially for someone new to Angular. Thank you!