export class DataTableFilterDemo implements OnInit {
cars: Car[];
cols: Column[];
constructor(private carService: CarService) {}
ngOnInit() {
this.carService.getCarsMedium().then(cars => this.cars = cars);
this.cols = [
{field: 'vin', header: 'Vin (startsWith)', filter: true},
{field: 'brand', header: 'Brand (contains)', filter: true, filterMatchMode: 'contains'},
{field: 'year', header: 'Year (startsWith)', filter: true},
{field: 'color', header: 'Color (endsWith)', filter: true, filterMatchMode: 'endsWith'}
];
}
}
<p-dataTable [value]="cars" [columns]="cols" [rows]="10" [paginator]="true">
<header>List of Cars</header>
</p-dataTable>