37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { Component, Input, OnInit, Output } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
import { IContextNode } from 'app/services/i-context-node';
|
|
import { MockCtxloaderService } from 'app/services/mock-ctxloader.service';
|
|
|
|
@Component({
|
|
standalone: true,
|
|
imports: [CommonModule],
|
|
selector: 'jhi-dyn-tab',
|
|
templateUrl: './dyn-tab.component.html',
|
|
styleUrls: ['./dyn-tab.component.scss'],
|
|
providers: [MockCtxloaderService],
|
|
})
|
|
export class DynTabComponent implements OnInit {
|
|
@Input() tabTitle: string | undefined;
|
|
@Input() active = false;
|
|
@Input() isCloseable = false;
|
|
@Input() template: any;
|
|
@Input() dataContext: any;
|
|
//TODO: IMPORTARE LA RADICE COME UN PARAMETRO INIETTATO DA PARENT
|
|
@Input() myCtx: IContextNode; //from parent
|
|
|
|
nestedContexts: IContextNode[] | any;
|
|
|
|
constructor(private myContextService: MockCtxloaderService) {
|
|
this.myCtx = {} as IContextNode;
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.myContextService.getData().subscribe(res => {
|
|
this.nestedContexts = res;
|
|
//inizializzo il contesto alla radice
|
|
this.myCtx = this.nestedContexts[0];
|
|
});
|
|
}
|
|
}
|