-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-tabs displaying empty 200px div when no content #2068
Comments
in the docs it is stated that if you set the label attribute for a md-tab than hasContent is assumed (=== true). If you add the new md-tab-label tag within the md-tab than hasContent is false if no specific tab content tag is defined. I had to rewrite the tabs within our application from label to md-tab-label. |
This is a valid bug if this is still happening in master. The original logic was based on whether or not a label attribute was being used; however, for the sake of simplicity, it would be nice to support empty content in this case as well. |
this is still happening in master |
@robertmesserle So we are using the However, the current logic for /**
* Determines if the tab content area is needed.
*/
function updateHasContent () {
var hasContent = false;
angular.forEach(ctrl.tabs, function (tab) {
if (tab.template) hasContent = true;
});
ctrl.hasContent = hasContent;
} Unfortunately, developers may not realize that whitespace/return line counts as HTML content and will cause the 200px 'content' area to appear. For example, this html: <md-tabs md-selected="vm.selectedTabIndex">
<md-tab ng-repeat="tab in ::vm.tabs" md-on-select="vm.selectTab(tab)"
label="{{::tab.title}}">
</md-tab>
</md-tabs> Will cause the "content" area to appear since between the start and end tags of This "situation" was occurring on 4111c93, as of August 10, 2015. The solution, of course, is to ensure no space between <md-tabs md-selected="vm.selectedTabIndex">
<md-tab ng-repeat="tab in ::vm.tabs" md-on-select="vm.selectTab(tab)"
label="{{::tab.title}}"></md-tab>
</md-tabs> Just wondering if it isn't better instead to check for non-whitespace tab template? |
Just ran into another issue. I'm trying again to use However, i need to customize the Here is the code: <md-tabs flex class="md-hue-2 tabControl" md-no-bar md-no-ink
md-selected="vm.selectedTabIndex">
<md-tab ng-repeat="tab in vm.tabs">
<md-tab-label layout="row" layout-align="center center">
<span class="tabTitle">{{tab.title}}</span>
<md-icon class="tabCloseButton" md-svg-src="action:highlight_off"
ng-click="vm.removeTab(tab)"></md-icon>
</md-tab-label></md-tab>
</md-tabs> However, although It really looks like the This can, again, be resolved, by making sure there are is no whitespace. Updating the HTML above to have <md-tabs flex class="md-hue-2 tabControl" md-no-bar md-no-ink
md-selected="vm.selectedTabIndex">
<md-tab ng-repeat="tab in vm.tabs"><md-tab-label layout="row" layout-align="center center">
<span class="tabTitle">{{tab.title}}</span>
<md-icon class="tabCloseButton" md-svg-src="action:highlight_off"
ng-click="vm.removeTab(tab)"></md-icon>
</md-tab-label></md-tab>
</md-tabs> |
Please open this issue, as it's not immediately obvious that md-tabs needs to have zero characters, having a newline and spaces can be the equivalent of no content. Maybe a warning is appropriate, as the only reason I found the workaround is by chasing down this issue. |
+1 on this. I just experienced it! |
When using the md-tabs with no content there is still a 200pc container below the tabs. Looking at the source code it looks as if ng-if="$mdTabsCtrl.hasContent" is always returning true even if there is no content.
The text was updated successfully, but these errors were encountered: