Answer the question
In order to leave comments, you need to log in
Why content disappears when switching tabs?
I use mat-tab as a non-smart wrapper, and when switching between them, the content part disappears. But, at the first initialization, the content part is present. Why does content disappear when switching?
non-smart wrapper code:
<mat-tab-group mat-align-tabs="start" (selectedTabChange)="onTabChanged($event)" [selectedIndex]="selectIndex">
<ng-container *ngFor="let reportLabel of labels">
<mat-tab label="{{reportLabel}}">
<ng-content></ng-content>
</mat-tab>
</ng-container>
</mat-tab-group>
@Input() labels: any;
@Input() selectIndex: any;
@Output() tabChanged: EventEmitter<any> = new EventEmitter<any>();
onTabChanged(tabChangeEvent: MatTabChangeEvent): any {
this.tabChanged.emit(tabChangeEvent);
}
<app-tabs-group (tabChanged)="tabChanged($event)" [selectIndex]="0" [labels]="reportLabels">
<div class="wrap">
123123
</div>
</app-tabs-group>
reportLabels = ['1 год', '6 месяцев', '3 месяца', 'месяц'];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question