有没有一种方法可以根据屏幕大小在Angular Mat表中应用“ displayColumns”

时间:2020-10-18 16:00:48

标签: angular-material-table

在Angular Material表中,我们在组件文件中定义displayColumns,然后在html模板中应用它们。有什么方法可以根据屏幕大小动态分配displayColumns的值?

在移动设备上显示表格时,我只希望显示2或3列。

// part of component.ts
displayedColumns = ['compName', 'city', 'state', 'compCat', 'compSubcat', 'compClass', 'options'];

//part of html

      <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
      <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>

0 个答案:

没有答案