projects/wvr-elements/src/lib/wvr-manifest/wvr-manifest-entry/wvr-manifest-entry.component.ts
changeDetection | ChangeDetectionStrategy.Default |
selector | wvr-manifest-entry-component |
Properties |
|
Methods |
Inputs |
constructor(eRef: ElementRef
|
|||||||||
Parameters :
|
description | |
Type : any
|
|
mappingStrategy | |
Type : any
|
|
methods | |
Type : any
|
|
name | |
Type : any
|
|
options | |
Type : any
|
|
path | |
Type : any
|
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Private parent |
Type : WvrManifestComponent
|
import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
import { ComponentRegistryService } from '../../core/component-registry.service';
import { WvrBaseComponent } from '../../shared/wvr-base.component';
import { WvrManifestComponent } from '../wvr-manifest.component';
@Component({
selector: 'wvr-manifest-entry-component',
template: '',
changeDetection: ChangeDetectionStrategy.Default
})
export class WvrManifestEntryComponent implements OnInit {
@Input() name;
@Input() description;
@Input() methods;
@Input() path;
@Input() options;
@Input() mappingStrategy;
private parent: WvrManifestComponent;
constructor(
private readonly eRef: ElementRef<HTMLElement>,
private readonly componentRegistry: ComponentRegistryService<WvrBaseComponent>
) {
}
ngOnInit(): void {
const parentElem = this.eRef.nativeElement.closest('wvre-manifest, wvr-manifest-component');
if (parentElem) {
this.parent = this.componentRegistry.getComponentByElement(parentElem as HTMLElement) as WvrManifestComponent;
this.parent.addEntry(this);
} else {
console.warn(`WvrManifestEntryComponent ${this.name} is not contained with a WvrManifestComponent`);
}
}
}