简体   繁体   中英

How to set the tab as default tab in angular using angular material Tabs

I have implemented a sample angular app using the Grid and Tab components from angular material.

I have implemented data bonding between the grid and tabs such that number of grid values available that many tabs gets opened up.

But addition to this I have a ALL Summary Tab always available irrespective of grid values.

Please access my sample app here..

In my app I have the All Summary Tab set as default and its active as first run my application.

But I need to have the second tab to be active as I run my app ....can any body please help me to resolve this ...?

You can programmatically change the tab using selectedIndex.

This for example will set the tab to Ashlock, Jennifer

<mat-tab-group headerPosition="above" [selectedIndex]="1">

You can replace 1 with a variable in your component and change the index value to what ever you want it to be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM