Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/demo-app/tabs/tab-group-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ <h1>Tab Group Demo</h1>
</md-tab>
</md-tab-group>

<h1>Tab Group Hiding tabs Demo</h1>

<md-tab-group [hideTabs]="true" class="demo-tab-group">
<md-tab *ngFor="let tab of tabs; let i = index" [disabled]="i == 1">
<template md-tab-label>{{tab.label}}</template>
<template md-tab-content>
{{tab.content}}
<br>
<br>
<br>
<md-input placeholder="Tab Label" [(ngModel)]="tab.label"></md-input>
</template>
</md-tab>
</md-tab-group>

<h1>Async Tabs</h1>

<md-tab-group class="demo-tab-group">
Expand Down
6 changes: 5 additions & 1 deletion src/lib/tabs/tab-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
[id]="_getTabContentId(i)"
[class.md-tab-active]="selectedIndex == i"
[attr.aria-labelledby]="_getTabLabelId(i)">
<template [ngIf]="selectedIndex == i">
<template [ngIf]="selectedIndex == i && !hideTabs">
<template [portalHost]="tab.content"></template>
</template>
<div [ngIf]="selectedIndex == i && hideTabs"
[class.hidden]="selectedIndex !== i && hideTabs">
<template [portalHost]="tab.content"></template>
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions src/lib/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export class MdTabGroup {
private _isInitialized: boolean = false;

private _selectedIndex: number = 0;

@Input() hideTabs: boolean = false;
@Input()
set selectedIndex(value: number) {
if (value != this._selectedIndex && this.isValidIndex(value)) {
Expand Down