-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
needs triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
material 19.1.5
Description
im using a Mat-Tab-Group with <ng-template matTabContent>
to create a wizard (lazy), but the MatTab.selectedIndex don't work properly.
Example:
https://stackblitz.com/~/github.com/danielschmitz/tabs-as-wizard
demo: https://danielschmitz.github.io/tabs-as-wizard/
code: https://github.com/danielschmitz/tabs-as-wizard
Click "Next" Then "Back" ... dont works... but if click at radio.. the page back to 0 :-(
See
My simple code:
a mat-tab with selectedIndex
<mat-tab-group [(selectedIndex)]="selectedIndex">
<mat-tab label="Step 1">
<ng-template matTabContent>
<mat-card>
<mat-card-title>Step 1 - Basic Info</mat-card-title>
<mat-card-content>
..... form........
</mat-card-content>
<mat-card-actions>
<button mat-stroked-button color="primary" (click)="prevTab()" [disabled]="isFirst">Back</button>
<span class="spacer"></span>
<button mat-raised-button color="primary" (click)="nextTab()" [disabled]="isLast">Next</button>
</mat-card-actions>
The prevTab
code:
nextTab(): void {
if (!this.isLast) this.selectedIndex++;
}
prevTab(): void {
if (!this.isFirst) this.selectedIndex--;
}
Angular 19 & 20
Reproduction
StackBlitz link: https://stackblitz.com/~/github.com/danielschmitz/tabs-as-wizard
Steps to reproduce:
- Click Next Button
- In the Step 2, click Back (dont works)
- Click in the Radio Phone... page go back
Expected Behavior
- Click Next Button
- In the Step 2, click Back
- Page go back to Step 1
Actual Behavior
- Click Next Button
- In the Step 2, click Back (dont works)
- Click in the Radio Phone... page go back
Environment
- Angular: 19.2.0
- CDK/Material: 19.2.19
- Browser(s): Chrome, Edge, Brave
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Metadata
Metadata
Assignees
Labels
needs triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team