my-lib/tabs/tab-item/tab-item.ts
| encapsulation | ViewEncapsulation.None |
| selector | [tabItem],tab-item |
| templateUrl | ./tab-item.html |
Properties |
Methods |
Outputs |
Accessors |
constructor()
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:24
|
onClick
|
$event type: EventEmitter<any>
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:21
|
|
| _click | ||||||||
_click(e: )
|
||||||||
|
Defined in my-lib/tabs/tab-item/tab-item.ts:36
|
||||||||
|
Parameters :
Returns :
void
|
| ngAfterContentInit |
ngAfterContentInit()
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:34
|
|
Returns :
void
|
| setActive | ||||||||
setActive(val: )
|
||||||||
|
Defined in my-lib/tabs/tab-item/tab-item.ts:30
|
||||||||
|
Parameters :
Returns :
void
|
| _tabBarClass |
_tabBarClass:
|
Type : Object
|
Default value : {}
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:20
|
| panel |
panel:
|
Type : TabPanelComponent
|
Decorators : ContentChild
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:19
|
| tpl |
tpl:
|
Type : TemplateRef<any>
|
Decorators : ViewChild
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:18
|
| tabBarClass |
gettabBarClass()
|
|
Defined in my-lib/tabs/tab-item/tab-item.ts:22
|
import {
Component, ViewEncapsulation,
HostBinding, Input, TemplateRef,
ViewChild, HostListener, EventEmitter, Output,
AfterContentInit, ContentChild
} from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { tabsDefaultBarPrefixCls } from '../var';
import { ansycClassObj } from 'meepo-utils';
import { TabsComponent } from '../tabs';
import { TabPanelComponent } from '../tab-panel/tab-panel';
@Component({
selector: '[tabItem],tab-item',
templateUrl: './tab-item.html',
encapsulation: ViewEncapsulation.None
})
export class TabItemComponent implements AfterContentInit {
@ViewChild('ref') tpl: TemplateRef<any>;
@ContentChild(TabPanelComponent) panel: TabPanelComponent;
_tabBarClass: Object = {};
@Output() onClick: EventEmitter<any> = new EventEmitter();
get tabBarClass() {
return ansycClassObj(this._tabBarClass);
}
constructor() {
this._tabBarClass[`${tabsDefaultBarPrefixCls}-tab`] = true;
}
setActive(val) {
this._tabBarClass[`am-tabs-default-bar-tab-active`] = val;
}
ngAfterContentInit() { }
_click(e) {
this.onClick.emit(e);
}
}
<ng-template #ref let-index>
<div [class]="tabBarClass" (click)="_click(index)">
<ng-content></ng-content>
</div>
</ng-template>