I am using this code
It's like bugs is saying, you can just use *ngIf
. Compare these two tables here:
https://stackblitz.com/edit/angular-w9ckf8
My empty table
0">
Name
{{element.name}}
Age
{{element.age}}
No records found
My full table
0">
Name
{{element.name}}
Age
{{element.age}}
No data
TS with data:
displayedColumns = ['Name', 'Age']
dataSource = [{name:'Sara',age:17}, {name: 'John', age: 20}]
dataSourceEmpty = []