1
0
mirror of https://github.com/Eugeny/tabby.git synced 2025-08-02 07:26:58 +00:00
Files
tabby/tabby-settings/src/components/settingsTabBody.component.ts
Eugene Pankov 43cd3318da project rename
2021-06-29 23:57:04 +02:00

27 lines
930 B
TypeScript

import { Component, Input, ViewContainerRef, ViewChild, ComponentFactoryResolver, ComponentRef } from '@angular/core'
import { SettingsTabProvider } from '../api'
/** @hidden */
@Component({
selector: 'settings-tab-body',
template: '<ng-template #placeholder></ng-template>',
})
export class SettingsTabBodyComponent {
@Input() provider: SettingsTabProvider
@ViewChild('placeholder', { read: ViewContainerRef }) placeholder: ViewContainerRef
component: ComponentRef<Component>
constructor (private componentFactoryResolver: ComponentFactoryResolver) { }
ngAfterViewInit (): void {
// run after the change detection finishes
setImmediate(() => {
this.component = this.placeholder.createComponent(
this.componentFactoryResolver.resolveComponentFactory(
this.provider.getComponentType()
)
)
})
}
}