Material: Is there a way to select a tab programatically?

Created on 25 Aug 2014  路  3Comments  路  Source: angular/material

Hi,

This is how I have implemented tab in my application

<material-tabs selected="selectedTab" center>

<material-tab label="first"></material-tab>

<material-tab label="second"></material-tab>

</material-tabs>

<div class="animate-switch-container" ng-switch on="selectedTab">



<div class="animate-switch" ng-switch-when="0">

Some content

</div>





<div class="animate-switch" ng-switch-when="1">

Some content

</div>

When I try to set the selectedTab variable in my controller, the tab does not move to the one selected. Is this the intended behaviour or am I missing something?

Most helpful comment

If somewhere stumbles upon this one, that's md-selected and not selected.

All 3 comments

I don't think the "selected" attribute is bound to material-tabs. Assigning a value during runtime does not change the selected tab. Any way around this?

Basically what I'm trying to do here is run an xhr request based on selection in tab 1. If results are received, the tab 2 content get populated and tab 2 is selected.

Thanks

@see Dynamic Tabs Demo and view source:

<material-tabs md-selected="selectedIndex" style="background-color: #00bcd6">

If somewhere stumbles upon this one, that's md-selected and not selected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rtprakash picture rtprakash  路  3Comments

PeerInfinity picture PeerInfinity  路  3Comments

achaussende picture achaussende  路  3Comments

chriseyhorn picture chriseyhorn  路  3Comments

WebTechnolog picture WebTechnolog  路  3Comments