答案 0 :(得分:0)
-- HTML code -------------
<mat-card>
<mat-card-content>
<h2 class="example-h2">Tabs with text labels</h2>
<mat-tab-group class="demo-tab-group">
<mat-tab label="Tab 1">
<div class="demo-tab-content">
<mat-table [dataSource]="dataSource>
<ng-container matColumnDef="countryname">
<mat-header-cell *matHeaderCellDef mat-sort-header>Coloumn Header Name </mat-header-cell>
<mat-cell *matCellDef="let abc">
{{abc.your value from displayedColumns1}}
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</div>
</mat-tab>
<mat-tab label="Tab 2">
<mat-table [dataSource]="dataSource2>
<ng-container matColumnDef="countryname">
<mat-header-cell *matHeaderCellDef mat-sort-header>Coloumn Header Name </mat-header-cell>
<mat-cell *matCellDef="let abc">
{{abc.your value from displayedColumns2}}
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</mat-tab>
<mat-tab label="Tab 3" disabled>
<mat-table [dataSource]="dataSource3>
<ng-container matColumnDef="countryname">
<mat-header-cell *matHeaderCellDef mat-sort-header>Coloumn Header Name </mat-header-cell>
<mat-cell *matCellDef="let abc">
{{abc.your value from displayedColumns3}}
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</mat-tab>
</mat-tab-group>
</mat-card-content>
</mat-card>
-----------ts code -----------------
displayedColumns = ['a', 'b', 'c', 'd'];
dataSource;
displayedColumns = ['a', 'b', 'c', 'd'];
dataSource1;
displayedColumns = ['a', 'b', 'c', 'd'];
dataSource1;