From 3ceaaec8960a784f0794dc2ff36bcca7ec1c806d Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 3 Jun 2017 15:19:32 +0200 Subject: [PATCH] Revert "Revert "Revert ".""" This reverts commit 5eac621ac5712451a6d598a8c8b78082df9e4d25. --- .../components/settingsTabBody.component.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/terminus-settings/src/components/settingsTabBody.component.ts b/terminus-settings/src/components/settingsTabBody.component.ts index 2616617a..c3b6e519 100644 --- a/terminus-settings/src/components/settingsTabBody.component.ts +++ b/terminus-settings/src/components/settingsTabBody.component.ts @@ -1,10 +1,25 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, ViewContainerRef, ViewChild, ComponentFactoryResolver, ComponentRef } from '@angular/core' import { SettingsTabProvider } from '../api' @Component({ selector: 'settings-tab-body', - template: '', + template: '', }) export class SettingsTabBodyComponent { @Input() provider: SettingsTabProvider + @ViewChild('placeholder', {read: ViewContainerRef}) placeholder: ViewContainerRef + private component: ComponentRef + + constructor (private componentFactoryResolver: ComponentFactoryResolver) { } + + ngAfterViewInit () { + // run after the change detection finishes + setImmediate(() => { + this.component = this.placeholder.createComponent( + this.componentFactoryResolver.resolveComponentFactory( + this.provider.getComponentType() + ) + ) + }) + } }