我的材料表如下:
<table mat-table [dataSource]="dataSource" >
... Rows ...
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator #MatPaginator [pageSizeOptions]="[4]" showFirstLastButtons></mat-paginator>
当变量info
为false时,我需要隐藏表。
- 尝试1:
<table *ngIf="info" mat-table [dataSource]="dataSource" >
它工作正常,但是当info
为true并且所有行都显示在第一页上时,分页不起作用。
- 尝试2:
<table [hidden]="!info" mat-table [dataSource]="dataSource" >
进行分页工作,但是当info
为假时,该表仍然显示,没有结果。
- 尝试3:
试图用div
包围整个表并将*ngIf
应用于div。结果:与第一次尝试相同的问题。
试图将[hidden]
应用于div
,但仍不隐藏。
- 编辑:尝试4:
直接应用于不断发展的div
css style="display:none"
并获得与尝试3相同的结果,即使没有值,也会显示该表。
关于
info
为假时如何隐藏表格并将其显示的任何想法info
在工作分页中正确时是什么?
谢谢!