material icon indicating copy to clipboard operation
material copied to clipboard

Is there a way to select a tab programatically?

Open nikhildev opened this issue 12 years ago • 3 comments

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?

nikhildev avatar Aug 25 '14 12:08 nikhildev

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

nikhildev avatar Aug 26 '14 05:08 nikhildev

@see Dynamic Tabs Demo and view source:

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

ThomasBurleson avatar Aug 26 '14 15:08 ThomasBurleson

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

warpdesign avatar Dec 18 '17 13:12 warpdesign