md-tab not transcluding content when md-tab-label is present
Hey guys,
I just downloaded v0.9.0-rc1-master-9655945 with great anticipation. Though I quickly found a problem with md-tab.
My md-tabs are loaded dynamically and use the following html.
<md-tabs md-selected="tabs.selectedIndex" class="md-primary">
<md-tab ng-repeat="tab in tabs.mytabs"
md-on-select="tabs.onTabSelected(tab)"
md-on-deselect="tabs.announceDeselected(tab)">
<md-tab-label>
<div layout="row" layout-fill layout-padding layout-align="center">
{{tab.title}}
<span ng-click="tabs.closeTab(tab)" ng-if="tab.canClose">
<span class="glyphicon glyphicon-remove" style="margin-left:3px" />
</span>
</div>
</md-tab-label>
<div ng-class="tab.style" layout="column" layout-fill>
<div flex ng-include="tab.page" class="tab-text"></div>
</div>
</md-tab>
</md-tabs>
Everything worked splendidly in 0.8.3. Now when the tabs load up there is no content. I found that if change the html to the following, everything works again. Leads me to believe there is an issue with the tab content transclusion when there is an md-tab-label present.
<md-tabs md-selected="tabs.selectedIndex" class="md-primary">
<md-tab ng-repeat="tab in tabs.mytabs"
md-on-select="tabs.onTabSelected(tab)"
md-on-deselect="tabs.announceDeselected(tab)"
label="{{tab.title}}">
<div ng-class="tab.style" layout="column" layout-fill>
<div flex ng-include="tab.page" class="tab-text"></div>
</div>
</md-tab>
</md-tabs>
You know, there is nothing like posting a new issue to get you thinking.
Looking at the tab demos, specifically the one for external content. I noticed it was using md-tab-label. Then I saw it had a new element called: <md-tab-template>.
After changing my markup to look like the following it worked!
<md-tabs md-selected="tabs.selectedIndex" class="md-primary">
<md-tab ng-repeat="tab in tabs.mytabs"
md-on-select="tabs.onTabSelected(tab)"
md-on-deselect="tabs.announceDeselected(tab)">
<md-tab-label>
<div layout="row" layout-fill layout-padding layout-align="center">
{{tab.title}}
<span ng-click="tabs.closeTab(tab)" ng-if="tab.canClose">
<span class="glyphicon glyphicon-remove" style="margin-left:3px" />
</span>
</div>
</md-tab-label>
<md-tab-template ng-class="tab.style" layout="column" layout-fill>
<div flex ng-include="tab.page" class="tab-text"></div>
</md-tab-template>
</md-tab>
</md-tabs>
@ACDN Yea, this is because we added a requirement for md-tab-template. After discussing with @ThomasBurleson, this will likely be renamed to md-tab-body since template isn't the most intuitive name.
Thanks @ACDN I was looking for same thing
I don't mind it being called md-tab-template. From a developers perspective it is clear. When I saw it the demo html I knew exactly what it was for.
Glad I could help you out piotr-gawlowski.
I'm building a pretty complex single page site based on this amazing framework. With this update to material design and angular 1.4 things are screaming along :)
For anyone who changed their markup to md-tab-template, rc1 now expects: md-tab-body
anyone know how i update tab becouse i am selected tab but not active tab $scope.$watch('selectedIndex', function(current, old){ console.log('current',current); console.log('old',old); });