提交 3ceaaec8 编写于 作者: E Eugene Pankov

Revert "Revert "Revert "."""

This reverts commit 5eac621a.
上级 5eac621a
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: '<ng-container *ngComponentOutlet="provider.getComponentType()"></ng-container>',
template: '<ng-template #placeholder></ng-template>',
})
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()
)
)
})
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册