Looking to programmatically change the selected mat-tab in a TypeScript file. I came across a solution for md-tab, but I need it for mat-tab. I attempted the suggested solution without success. Here's what I tried:
HTML
<button class="btn btn-primary" (click)="changeTab()">Click me!</button>
<mat-tab-group [selectedIndex]="selectedTab">
<mat-tab label="Preview">
</mat-tab>
<mat-tab label="Tuning">
<car-tuning></car-tuning>
</mat-tab>
<mat-tab label="Payment"></mat-tab>
</mat-tab-group>
.TS File
changeTab() {
this.selectedTab =1;
}