1
0

103176: Fix vcr not being defined yet in OnInit hook

This commit is contained in:
Alexandre Vryghem
2023-06-27 15:26:49 +02:00
committed by Tim Donohue
parent 6ad641f4e2
commit 0e289b3f39

View File

@@ -1,10 +1,10 @@
import { import {
AfterViewInit,
Component, Component,
ViewChild, ViewChild,
ViewContainerRef, ViewContainerRef,
ComponentRef, ComponentRef,
SimpleChanges, SimpleChanges,
OnInit,
OnDestroy, OnDestroy,
ComponentFactoryResolver, ComponentFactoryResolver,
ChangeDetectorRef, ChangeDetectorRef,
@@ -24,7 +24,7 @@ import { BASE_THEME_NAME } from './theme.constants';
styleUrls: ['./themed.component.scss'], styleUrls: ['./themed.component.scss'],
templateUrl: './themed.component.html', templateUrl: './themed.component.html',
}) })
export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges { export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, OnChanges {
@ViewChild('vcr', { read: ViewContainerRef }) vcr: ViewContainerRef; @ViewChild('vcr', { read: ViewContainerRef }) vcr: ViewContainerRef;
@ViewChild('content') themedElementContent: ElementRef; @ViewChild('content') themedElementContent: ElementRef;
protected compRef: ComponentRef<T>; protected compRef: ComponentRef<T>;
@@ -74,7 +74,7 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
} }
} }
ngOnInit(): void { ngAfterViewInit(): void {
this.destroyComponentInstance(); this.destroyComponentInstance();
this.initComponentInstance(); this.initComponentInstance();
} }