import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'dynamic-table', templateUrl: './dynamic-table.component.html', styleUrls: ['./dynamic-table.component.scss'] }) export class DynamicTableComponent implements OnInit { @Input() objectsArray: any[]; @Input() properties: string[]; @Input() headers: string[]; @Input() title: string; @Input() validValuesOnly = false; constructor() { } ngOnInit() { } /* row is valid if has no integer with 0 value */ public isValidRow(objectData: any): boolean { if (this.validValuesOnly) { for (const property of this.properties) { const value = objectData[property]; if (typeof value === 'number') { if (value === 0) { return false; } } } } return true; } }