export class DataTableFacetsDemo implements OnInit {
cars: Car[];
cols: Column[];
constructor(private carService:CarService) {
}
ngOnInit() {
this.carService.getCarsSmall().then(cars => this.cars = cars);
this.cols = [
{field: 'vin', header: 'Vin'},
{field: 'brand', header: 'Brand'},
{field: 'year', header: 'Year'},
{field: 'color', header: 'Color'}
];
}
}
<p-dataTable [value]="cars" [columns]="cols">
<header>List of Cars</header>
<footer>There are 10 cars</footer>
</p-dataTable>