mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-30 22:53:31 +03:00
.
This commit is contained in:
parent
73722c0b2f
commit
741f7ee8e5
@ -1,25 +1,10 @@
|
|||||||
import { Component, Input, ViewContainerRef, ViewChild, ComponentFactoryResolver, ComponentRef } from '@angular/core'
|
import { Component, Input } from '@angular/core'
|
||||||
import { SettingsTabProvider } from '../api'
|
import { SettingsTabProvider } from '../api'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'settings-tab-body',
|
selector: 'settings-tab-body',
|
||||||
template: '<ng-template #placeholder></ng-template>',
|
template: '<ng-container *ngComponentOutlet="provider.getComponentType()"></ng-container>',
|
||||||
})
|
})
|
||||||
export class SettingsTabBodyComponent {
|
export class SettingsTabBodyComponent {
|
||||||
@Input() provider: SettingsTabProvider
|
@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()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user