When tab inside tab then if selected index of sub tab is 1 then it should show as selected.
Let parent tab has two tabs, it has selectedIndex
is 0, and sub tab inside parent tab1 has selectedIndex
= 1 then content inside it showing but is not showing as selected. Tab content is showing but tab is not selected
Here is the working example
There is currently an open issue for this. As a workaround you can use 2 way binding on your parent tab selectedIndex
and then only show the subtab group when the parent tab is selected:
<mat-tab-group [(selectedIndex)]="index">
<mat-tab label="Tab 1">Parent tab 1 Content</mat-tab>
<mat-tab label="Tab 2">
<mat-tab-group *ngIf="index == 1" [selectedIndex]="1">
<mat-tab label="Tab 1">sub tab 1 Content </mat-tab>
<mat-tab label="Tab 2">sub tab 2 Content
</mat-tab>
</mat-tab-group>
</mat-tab>
</mat-tab-group>
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With