How to show empty message in data table angular material, If no data found

前端 未结 18 731
别那么骄傲
别那么骄傲 2021-01-07 16:51

I am using this code

 
  
    

        
18条回答
  •  囚心锁ツ
    2021-01-07 17:28

    If you console.log dataSource, you will see the following: dataSource example

    It is not the dataSource itself that is the array, but dataSource.data. dataSource is actually a class that has a property data that contains what you pass into MatTableDataSource (https://github.com/angular/material2/blob/master/src/lib/table/table-data-source.ts) Therefore, this is what you should be using for your *ngIf statement.

    No Records Found!

    Hope this helps!

提交回复
热议问题