// Angular // import { Input, Output, Component, EventEmitter } from '@angular/core'; // Other // import * as _ from 'underscore'; // Todo importera styles enligt wiki /vile @Component({ selector: 'fb-tabset', templateUrl: './fb-tabset.component.html', styleUrls: [/*'./fb-tabset.component.less'*/] }) export class FbTabsetComponent { // Inputs @Input() tabList: any[]; @Input() nameAttr: string = 'name'; @Input() activeAttr: string = 'active'; // Outputs @Output() onSelect: EventEmitter = new EventEmitter(); selectTab(selectTab: any): void { _.each(this.tabList, (tab) => { if (tab[this.activeAttr] && tab === selectTab) { return; } tab[this.activeAttr] = tab === selectTab; }); this.onSelect.emit(selectTab); } }