Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material Tab Active issue

I'm beginner for the Angular and Angular Material, I used mat-tab

The active mat-tab is always the first tab, anyone know how to activate the 2nd tab when the using Angular material?

code

<mat-tab-group>
      <mat-tab label="First"> Content 1 </mat-tab>
      <mat-tab label="Second"> Content 2 </mat-tab>
      <mat-tab label="Third"> Content 3 </mat-tab>
    </mat-tab-group>
like image 402
core114 Avatar asked Oct 23 '25 16:10

core114


1 Answers

use the selectedIndex property

<mat-tab-group class="m-t-30" [selectedIndex]="1">
like image 66
Sachila Ranawaka Avatar answered Oct 26 '25 06:10

Sachila Ranawaka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!