Add missing import

This commit is contained in:
Jens Vannerum
2022-12-05 09:07:54 +01:00
parent 7d39f5de83
commit 73aa164f0f

View File

@@ -11,7 +11,7 @@ import {
OnChanges OnChanges
} from '@angular/core'; } from '@angular/core';
import { hasValue, isNotEmpty } from '../empty.util'; import { hasValue, isNotEmpty } from '../empty.util';
import { from as fromPromise, Observable, of as observableOf, Subscription } from 'rxjs'; import { from as fromPromise, Observable, of as observableOf, Subscription, BehaviorSubject } from 'rxjs';
import { ThemeService } from './theme.service'; import { ThemeService } from './theme.service';
import { catchError, switchMap, map } from 'rxjs/operators'; import { catchError, switchMap, map } from 'rxjs/operators';
import { GenericConstructor } from '../../core/shared/generic-constructor'; import { GenericConstructor } from '../../core/shared/generic-constructor';
@@ -25,6 +25,12 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
@ViewChild('vcr', { read: ViewContainerRef }) vcr: ViewContainerRef; @ViewChild('vcr', { read: ViewContainerRef }) vcr: ViewContainerRef;
protected compRef: ComponentRef<T>; protected compRef: ComponentRef<T>;
/**
* A reference to the themed component. Will start as undefined and emit every time the themed
* component is rendered
*/
public compRef$: BehaviorSubject<ComponentRef<T>> = new BehaviorSubject(undefined);
protected lazyLoadSub: Subscription; protected lazyLoadSub: Subscription;
protected themeSub: Subscription; protected themeSub: Subscription;
@@ -90,6 +96,7 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
const factory = this.resolver.resolveComponentFactory(constructor); const factory = this.resolver.resolveComponentFactory(constructor);
this.compRef = this.vcr.createComponent(factory); this.compRef = this.vcr.createComponent(factory);
this.connectInputsAndOutputs(); this.connectInputsAndOutputs();
this.compRef$.next(this.compRef);
this.cdr.markForCheck(); this.cdr.markForCheck();
}); });
} }