【发布时间】:2021-05-03 09:44:53
【问题描述】:
我在我的项目中使用 mat-stepper,在侧面 mat-stepper 中我有 mat-Datatable。 在每一步我都必须隐藏和显示不同的列,所以我想向每一步发送一些数据更改这可能吗?
我在考虑 stepper 是否为此目的提供某种事件处理。
在此先感谢您。
已编辑
stepper.ts
onSelectionChange(e: any){
this.selectedIndex = e.selectedIndex;
}
stepper.html
<mat-horizontal-stepper (selectionChange)="onSelectionChange($event)" labelPosition="bottom" #stepper>
<mat-step>
<ng-template matStepLabel>DataTable</ng-template>
<app-data-table [selectedIndex]="selectedIndex"></app-data-table>
</mat-step>
</mat-horizontal-stepper>
datatable.ts
@Input() selectedIndex: any;
show: boolean = false;
if (this.selectedIndex != 3)
{this.show = true;}
datatable.html
<ng-container matColumnDef="delete">
<th mat-header-cell *matHeaderCellDef [hidden]="!show">Delete</th>
<td mat-cell *matCellDef="let element" [hidden]="!show">
<button><mat-icon>delete</mat-icon></button>
</td>
</ng-container>
【问题讨论】:
标签: angular