/
githubmirror
/
tabby
Обзор
Документация
Войти
/
githubmirror
/
tabby
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tabby-settings/src/components/settingsTabBody.component.ts
33 строки
1 KB
qyecst
Update settingsTabBody.component.ts
23 июн 2023, 22:27
Не верифицирован
23 июн 2023, 22:27
1579356
Код
Авторство
О чём код?
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>', styles: [` :host { display: block; padding-bottom: 20px; max-width: 600px; } `], }) export class SettingsTabBodyComponent { @Input() provider: SettingsTabProvider @ViewChild('placeholder', { read: ViewContainerRef }) placeholder: ViewContainerRef component: ComponentRef<unknown> constructor (private componentFactoryResolver: ComponentFactoryResolver) { } ngAfterViewInit (): void { // run after the change detection finishes setImmediate(() => { this.component = this.placeholder.createComponent( this.componentFactoryResolver.resolveComponentFactory( this.provider.getComponentType(), ), ) }) } }