Skip to content

Commit

Permalink
feat(tab): add tab id support (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSurmay authored and valorkin committed Oct 13, 2017
1 parent 8da0c94 commit 89defda
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo/src/app/components/+tabs/demos/basic/basic.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<tabset>
<tab heading="Static title">Static content</tab>
<tab heading="Static title" id="tab1">Static content</tab>
<tab heading="Static Title 1">Static content 1</tab>
<tab heading="Static Title 2">Static content 2</tab>
<tab (select)="alertMe()">
Expand Down
3 changes: 1 addition & 2 deletions demo/src/app/components/+tabs/demos/basic/basic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, ViewChild } from '@angular/core';
import { TabsetComponent } from 'ngx-bootstrap';
import { Component } from '@angular/core';

@Component({
selector: 'demo-tabs-basic',
Expand Down
2 changes: 1 addition & 1 deletion demo/src/assets/json/current-version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"2.0.0-beta.5"}
{"version":"2.0.0-beta.6"}
2 changes: 1 addition & 1 deletion demo/src/ng-api-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2464,7 +2464,7 @@ export const ngdoc: any = {
{
"name": "id",
"type": "string",
"description": "<p>tab id </p>\n"
"description": "<p>tab id. The same id with suffix &#39;-link&#39; will be added to the corresponding &lt;li&gt; element </p>\n"
},
{
"name": "removable",
Expand Down
7 changes: 4 additions & 3 deletions src/tabs/tab.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { TabsetComponent } from './tabset.component';
@Directive({ selector: 'tab, [tab]' })
export class TabDirective implements OnInit, OnDestroy {
/** tab header text */
@Input() heading: string;
/** tab id */
@Input() id: string;
@Input() public heading: string;
/** tab id. The same id with suffix '-link' will be added to the corresponding &lt;li&gt; element */
@HostBinding('attr.id')
@Input() public id: string;
/** if true tab can not be activated */
@Input() disabled: boolean;
/** if true tab can be removable, additional button will appear */
Expand Down
1 change: 1 addition & 0 deletions src/tabs/tabset.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<li *ngFor="let tabz of tabs" [ngClass]="['nav-item', tabz.customClass || '']"
[class.active]="tabz.active" [class.disabled]="tabz.disabled">
<a href="javascript:void(0);" class="nav-link"
[attr.id]="tabz.id ? tabz.id + '-link' : ''"
[class.active]="tabz.active" [class.disabled]="tabz.disabled"
(click)="tabz.active = true">
<span [ngTransclude]="tabz.headingRef">{{ tabz.heading }}</span>
Expand Down

0 comments on commit 89defda

Please sign in to comment.