mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Destroy dynamically generated components in onDestroy & replace deprecated createComponent
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentFactoryResolver, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, OnInit, ViewChild, ComponentRef, OnDestroy } from '@angular/core';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import {
|
import {
|
||||||
@@ -13,6 +13,7 @@ import { BitstreamDataService } from '../../../../../core/data/bitstream-data.se
|
|||||||
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
|
||||||
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||||
|
import { hasValue } from '../../../../../shared/empty.util';
|
||||||
|
|
||||||
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch)
|
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -23,15 +24,16 @@ import { ThemeService } from '../../../../../shared/theme-support/theme.service'
|
|||||||
/**
|
/**
|
||||||
* The component for displaying a list element for an item search result on the admin search page
|
* The component for displaying a list element for an item search result on the admin search page
|
||||||
*/
|
*/
|
||||||
export class ItemAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> implements OnInit {
|
export class ItemAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> implements OnDestroy, OnInit {
|
||||||
@ViewChild(ListableObjectDirective, { static: true }) listableObjectDirective: ListableObjectDirective;
|
@ViewChild(ListableObjectDirective, { static: true }) listableObjectDirective: ListableObjectDirective;
|
||||||
@ViewChild('badges', { static: true }) badges: ElementRef;
|
@ViewChild('badges', { static: true }) badges: ElementRef;
|
||||||
@ViewChild('buttons', { static: true }) buttons: ElementRef;
|
@ViewChild('buttons', { static: true }) buttons: ElementRef;
|
||||||
|
|
||||||
|
protected compRef: ComponentRef<Component>;
|
||||||
|
|
||||||
constructor(protected truncatableService: TruncatableService,
|
constructor(protected truncatableService: TruncatableService,
|
||||||
protected bitstreamDataService: BitstreamDataService,
|
protected bitstreamDataService: BitstreamDataService,
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver
|
|
||||||
) {
|
) {
|
||||||
super(truncatableService, bitstreamDataService);
|
super(truncatableService, bitstreamDataService);
|
||||||
}
|
}
|
||||||
@@ -41,23 +43,32 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
|
|||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
|
const component: GenericConstructor<Component> = this.getComponent();
|
||||||
|
|
||||||
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
|
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(
|
this.compRef = viewContainerRef.createComponent(
|
||||||
componentFactory,
|
component, {
|
||||||
0,
|
index: 0,
|
||||||
undefined,
|
injector: undefined,
|
||||||
[
|
projectableNodes: [
|
||||||
[this.badges.nativeElement],
|
[this.badges.nativeElement],
|
||||||
[this.buttons.nativeElement]
|
[this.buttons.nativeElement],
|
||||||
]);
|
],
|
||||||
(componentRef.instance as any).object = this.object;
|
},
|
||||||
(componentRef.instance as any).index = this.index;
|
);
|
||||||
(componentRef.instance as any).linkType = this.linkType;
|
(this.compRef.instance as any).object = this.object;
|
||||||
(componentRef.instance as any).listID = this.listID;
|
(this.compRef.instance as any).index = this.index;
|
||||||
|
(this.compRef.instance as any).linkType = this.linkType;
|
||||||
|
(this.compRef.instance as any).listID = this.listID;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (hasValue(this.compRef)) {
|
||||||
|
this.compRef.destroy();
|
||||||
|
this.compRef = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentFactoryResolver, ElementRef, ViewChild } from '@angular/core';
|
import { Component, ElementRef, ViewChild, ComponentRef, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import {
|
import {
|
||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||||
|
import { hasValue } from '../../../../../shared/empty.util';
|
||||||
|
|
||||||
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch)
|
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -33,7 +34,7 @@ import { ThemeService } from '../../../../../shared/theme-support/theme.service'
|
|||||||
/**
|
/**
|
||||||
* The component for displaying a grid element for an workflow item on the admin workflow search page
|
* The component for displaying a grid element for an workflow item on the admin workflow search page
|
||||||
*/
|
*/
|
||||||
export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends SearchResultGridElementComponent<WorkflowItemSearchResult, WorkflowItem> {
|
export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends SearchResultGridElementComponent<WorkflowItemSearchResult, WorkflowItem> implements OnDestroy, OnInit {
|
||||||
/**
|
/**
|
||||||
* Directive used to render the dynamic component in
|
* Directive used to render the dynamic component in
|
||||||
*/
|
*/
|
||||||
@@ -54,8 +55,9 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
|
|||||||
*/
|
*/
|
||||||
public item$: Observable<Item>;
|
public item$: Observable<Item>;
|
||||||
|
|
||||||
|
protected compRef: ComponentRef<Component>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
|
||||||
private linkService: LinkService,
|
private linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
@@ -73,28 +75,37 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
|
|||||||
this.dso = this.linkService.resolveLink(this.dso, followLink('item'));
|
this.dso = this.linkService.resolveLink(this.dso, followLink('item'));
|
||||||
this.item$ = (this.dso.item as Observable<RemoteData<Item>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
|
this.item$ = (this.dso.item as Observable<RemoteData<Item>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
|
||||||
this.item$.pipe(take(1)).subscribe((item: Item) => {
|
this.item$.pipe(take(1)).subscribe((item: Item) => {
|
||||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent(item));
|
const component: GenericConstructor<Component> = this.getComponent(item);
|
||||||
|
|
||||||
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
|
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(
|
this.compRef = viewContainerRef.createComponent(
|
||||||
componentFactory,
|
component, {
|
||||||
0,
|
index: 0,
|
||||||
undefined,
|
injector: undefined,
|
||||||
[
|
projectableNodes: [
|
||||||
[this.badges.nativeElement],
|
[this.badges.nativeElement],
|
||||||
[this.buttons.nativeElement]
|
[this.buttons.nativeElement],
|
||||||
]);
|
],
|
||||||
(componentRef.instance as any).object = item;
|
},
|
||||||
(componentRef.instance as any).index = this.index;
|
);
|
||||||
(componentRef.instance as any).linkType = this.linkType;
|
(this.compRef.instance as any).object = item;
|
||||||
(componentRef.instance as any).listID = this.listID;
|
(this.compRef.instance as any).index = this.index;
|
||||||
componentRef.changeDetectorRef.detectChanges();
|
(this.compRef.instance as any).linkType = this.linkType;
|
||||||
|
(this.compRef.instance as any).listID = this.listID;
|
||||||
|
this.compRef.changeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (hasValue(this.compRef)) {
|
||||||
|
this.compRef.destroy();
|
||||||
|
this.compRef = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the component depending on the item's entity type, view mode and context
|
* Fetch the component depending on the item's entity type, view mode and context
|
||||||
* @returns {GenericConstructor<Component>}
|
* @returns {GenericConstructor<Component>}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, ComponentFactoryResolver, ChangeDetectorRef } from '@angular/core';
|
import { Component, Input, ChangeDetectorRef } from '@angular/core';
|
||||||
import { ThemedComponent } from '../theme-support/themed.component';
|
import { ThemedComponent } from '../theme-support/themed.component';
|
||||||
import { LoadingComponent } from './loading.component';
|
import { LoadingComponent } from './loading.component';
|
||||||
import { ThemeService } from '../theme-support/theme.service';
|
import { ThemeService } from '../theme-support/theme.service';
|
||||||
@@ -20,11 +20,10 @@ export class ThemedLoadingComponent extends ThemedComponent<LoadingComponent> {
|
|||||||
protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner'];
|
protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected resolver: ComponentFactoryResolver,
|
|
||||||
protected cdr: ChangeDetectorRef,
|
protected cdr: ChangeDetectorRef,
|
||||||
protected themeService: ThemeService
|
protected themeService: ThemeService
|
||||||
) {
|
) {
|
||||||
super(resolver, cdr, themeService);
|
super(cdr, themeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getComponentName(): string {
|
protected getComponentName(): string {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentFactoryResolver, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
import { Component, Inject, Input, OnInit, ViewChild, ComponentRef, OnDestroy } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
MetadataRepresentation,
|
MetadataRepresentation,
|
||||||
MetadataRepresentationType
|
MetadataRepresentationType
|
||||||
@@ -19,8 +19,9 @@ import { ThemeService } from '../theme-support/theme.service';
|
|||||||
/**
|
/**
|
||||||
* Component for determining what component to use depending on the item's entity type (dspace.entity.type), its metadata representation and, optionally, its context
|
* Component for determining what component to use depending on the item's entity type (dspace.entity.type), its metadata representation and, optionally, its context
|
||||||
*/
|
*/
|
||||||
export class MetadataRepresentationLoaderComponent implements OnInit {
|
export class MetadataRepresentationLoaderComponent implements OnDestroy, OnInit {
|
||||||
private componentRefInstance: MetadataRepresentationListElementComponent;
|
private componentRefInstance: MetadataRepresentationListElementComponent;
|
||||||
|
protected compRef: ComponentRef<MetadataRepresentationListElementComponent>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item or metadata to determine the component for
|
* The item or metadata to determine the component for
|
||||||
@@ -47,7 +48,6 @@ export class MetadataRepresentationLoaderComponent implements OnInit {
|
|||||||
@ViewChild(MetadataRepresentationDirective, {static: true}) mdRepDirective: MetadataRepresentationDirective;
|
@ViewChild(MetadataRepresentationDirective, {static: true}) mdRepDirective: MetadataRepresentationDirective;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
@Inject(METADATA_REPRESENTATION_COMPONENT_FACTORY) private getMetadataRepresentationComponent: (entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context, theme: string) => GenericConstructor<any>,
|
@Inject(METADATA_REPRESENTATION_COMPONENT_FACTORY) private getMetadataRepresentationComponent: (entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context, theme: string) => GenericConstructor<any>,
|
||||||
) {
|
) {
|
||||||
@@ -57,16 +57,23 @@ export class MetadataRepresentationLoaderComponent implements OnInit {
|
|||||||
* Set up the dynamic child component
|
* Set up the dynamic child component
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
|
const component: GenericConstructor<MetadataRepresentationListElementComponent> = this.getComponent();
|
||||||
|
|
||||||
const viewContainerRef = this.mdRepDirective.viewContainerRef;
|
const viewContainerRef = this.mdRepDirective.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
this.compRef = viewContainerRef.createComponent(component);
|
||||||
this.componentRefInstance = componentRef.instance as MetadataRepresentationListElementComponent;
|
this.componentRefInstance = this.compRef.instance as MetadataRepresentationListElementComponent;
|
||||||
this.componentRefInstance.metadataRepresentation = this.mdRepresentation;
|
this.componentRefInstance.metadataRepresentation = this.mdRepresentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (hasValue(this.compRef)) {
|
||||||
|
this.compRef.destroy();
|
||||||
|
this.compRef = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the component depending on the item's entity type, metadata representation type and context
|
* Fetch the component depending on the item's entity type, metadata representation type and context
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ComponentFactoryResolver,
|
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Input,
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
ViewChild
|
ViewChild, ComponentRef
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { getComponentByWorkflowTaskOption } from './claimed-task-actions-decorator';
|
import { getComponentByWorkflowTaskOption } from './claimed-task-actions-decorator';
|
||||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
@@ -64,8 +63,7 @@ export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
protected subs: Subscription[] = [];
|
protected subs: Subscription[] = [];
|
||||||
|
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver) {
|
protected compRef: ComponentRef<Component>;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch, create and initialize the relevant component
|
* Fetch, create and initialize the relevant component
|
||||||
@@ -74,13 +72,11 @@ export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const comp = this.getComponentByWorkflowTaskOption(this.option);
|
const comp = this.getComponentByWorkflowTaskOption(this.option);
|
||||||
if (hasValue(comp)) {
|
if (hasValue(comp)) {
|
||||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
|
||||||
|
|
||||||
const viewContainerRef = this.claimedTaskActionsDirective.viewContainerRef;
|
const viewContainerRef = this.claimedTaskActionsDirective.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
this.compRef = viewContainerRef.createComponent(comp);
|
||||||
const componentInstance = (componentRef.instance as ClaimedTaskActionsAbstractComponent);
|
const componentInstance = (this.compRef.instance as ClaimedTaskActionsAbstractComponent);
|
||||||
componentInstance.item = this.item;
|
componentInstance.item = this.item;
|
||||||
componentInstance.object = this.object;
|
componentInstance.object = this.object;
|
||||||
componentInstance.workflowitem = this.workflowitem;
|
componentInstance.workflowitem = this.workflowitem;
|
||||||
@@ -98,6 +94,10 @@ export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
|
|||||||
* Unsubscribe from open subscriptions
|
* Unsubscribe from open subscriptions
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
if (hasValue(this.compRef)) {
|
||||||
|
this.compRef.destroy();
|
||||||
|
this.compRef = undefined;
|
||||||
|
}
|
||||||
this.subs
|
this.subs
|
||||||
.filter((subscription) => hasValue(subscription))
|
.filter((subscription) => hasValue(subscription))
|
||||||
.forEach((subscription) => subscription.unsubscribe());
|
.forEach((subscription) => subscription.unsubscribe());
|
||||||
|
@@ -23,7 +23,7 @@ import { getListableObjectComponent } from './listable-object.decorator';
|
|||||||
import { GenericConstructor } from '../../../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../../../core/shared/generic-constructor';
|
||||||
import { ListableObjectDirective } from './listable-object.directive';
|
import { ListableObjectDirective } from './listable-object.directive';
|
||||||
import { CollectionElementLinkType } from '../../collection-element-link.type';
|
import { CollectionElementLinkType } from '../../collection-element-link.type';
|
||||||
import { hasValue, isNotEmpty } from '../../../empty.util';
|
import { hasValue, isNotEmpty, hasNoValue } from '../../../empty.util';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { ThemeService } from '../../../theme-support/theme.service';
|
import { ThemeService } from '../../../theme-support/theme.service';
|
||||||
|
|
||||||
@@ -141,8 +141,10 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
|
|||||||
* Setup the dynamic child component
|
* Setup the dynamic child component
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
if (hasNoValue(this.compRef)) {
|
||||||
this.instantiateComponent(this.object);
|
this.instantiateComponent(this.object);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever the inputs change, update the inputs of the dynamic component
|
* Whenever the inputs change, update the inputs of the dynamic component
|
||||||
@@ -153,7 +155,11 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy(): void {
|
||||||
|
if (hasValue(this.compRef)) {
|
||||||
|
this.compRef.destroy();
|
||||||
|
this.compRef = undefined;
|
||||||
|
}
|
||||||
this.subs
|
this.subs
|
||||||
.filter((subscription) => hasValue(subscription))
|
.filter((subscription) => hasValue(subscription))
|
||||||
.forEach((subscription) => subscription.unsubscribe());
|
.forEach((subscription) => subscription.unsubscribe());
|
||||||
|
@@ -6,7 +6,6 @@ import {
|
|||||||
SimpleChanges,
|
SimpleChanges,
|
||||||
OnInit,
|
OnInit,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
ComponentFactoryResolver,
|
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
OnChanges
|
OnChanges
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
@@ -31,7 +30,6 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
|
|||||||
protected inAndOutputNames: (keyof T & keyof this)[] = [];
|
protected inAndOutputNames: (keyof T & keyof this)[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected resolver: ComponentFactoryResolver,
|
|
||||||
protected cdr: ChangeDetectorRef,
|
protected cdr: ChangeDetectorRef,
|
||||||
protected themeService: ThemeService
|
protected themeService: ThemeService
|
||||||
) {
|
) {
|
||||||
@@ -87,8 +85,7 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
).subscribe((constructor: GenericConstructor<T>) => {
|
).subscribe((constructor: GenericConstructor<T>) => {
|
||||||
const factory = this.resolver.resolveComponentFactory(constructor);
|
this.compRef = this.vcr.createComponent(constructor);
|
||||||
this.compRef = this.vcr.createComponent(factory);
|
|
||||||
this.connectInputsAndOutputs();
|
this.connectInputsAndOutputs();
|
||||||
this.cdr.markForCheck();
|
this.cdr.markForCheck();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user