puddlejumper26 / blogs

Personal Tech Blogs
4 stars 1 forks source link

How to make MatSort working together with *ngIf #78

Open puddlejumper26 opened 4 years ago

puddlejumper26 commented 4 years ago

Use the hidden attribute from HTML5 instead of the ngIf directive:

 <table [hidden]="!isLoaded"> ... </table> 

Reference

[1] https://stackoverflow.com/questions/54205379/angular-material-table-sorting-data-doesnt-sort-when-inside-a-ngif-condition/54205623

[2] https://stackoverflow.com/questions/50767580/mat-filtering-mat-sort-not-work-correctly-when-use-ngif-in-mat-table-parent

[3] https://quick-geek.github.io/answers/954764/index.html