Revert "Revert ".""

This reverts commit fd67a3c697.
This commit is contained in:
Eugene Pankov 2017-06-03 15:07:42 +02:00
parent fd67a3c697
commit 5eac621ac5

View File

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