Browse Source

chore(html-container): drop unused ViewContainerRef and stale comments

Remove the no-longer-used ViewContainerRef injection and the commented-
out fallback branches now that initAngularComponent uses the
angularContainer view container exclusively.
pull/15556/head
Igor Kulikov 5 months ago
parent
commit
967991004a
  1. 7
      ui-ngx/src/app/modules/home/components/widget/lib/html/html-container-widget.component.ts

7
ui-ngx/src/app/modules/home/components/widget/lib/html/html-container-widget.component.ts

@ -24,7 +24,6 @@ import {
Optional, Optional,
Type, Type,
ViewChild, ViewChild,
ViewContainerRef,
ViewEncapsulation ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
import { WidgetContext } from '@home/models/widget-component.models'; import { WidgetContext } from '@home/models/widget-component.models';
@ -91,7 +90,6 @@ export class HtmlContainerWidgetComponent implements OnInit {
widgetErrorData: ExceptionData; widgetErrorData: ExceptionData;
constructor(private elementRef: ElementRef<HTMLElement>, constructor(private elementRef: ElementRef<HTMLElement>,
private containerRef: ViewContainerRef,
@Optional() @Inject(MODULES_MAP) private modulesMap: IModulesMap, @Optional() @Inject(MODULES_MAP) private modulesMap: IModulesMap,
@Inject(SHARED_MODULE_TOKEN) private sharedModule: Type<any>, @Inject(SHARED_MODULE_TOKEN) private sharedModule: Type<any>,
@Inject(WIDGET_COMPONENTS_MODULE_TOKEN) private widgetComponentsModule: Type<any>, @Inject(WIDGET_COMPONENTS_MODULE_TOKEN) private widgetComponentsModule: Type<any>,
@ -190,7 +188,6 @@ export class HtmlContainerWidgetComponent implements OnInit {
} }
private initAngularComponent(imports?: Type<any>[], containerFunction?: CompiledTbFunction<WidgetContainerAngularFunction>): void { private initAngularComponent(imports?: Type<any>[], containerFunction?: CompiledTbFunction<WidgetContainerAngularFunction>): void {
//this.containerRef.clear();
this.angularContainer.viewContainerRef.clear(); this.angularContainer.viewContainerRef.clear();
const destroyContainerInstanceResources = this.destroyContainerInstanceResources.bind(this); const destroyContainerInstanceResources = this.destroyContainerInstanceResources.bind(this);
const template = this.settings.html || ''; const template = this.settings.html || '';
@ -225,9 +222,9 @@ export class HtmlContainerWidgetComponent implements OnInit {
).subscribe({ ).subscribe({
next: (componentType) => { next: (componentType) => {
this.containerInstanceComponentType = componentType; this.containerInstanceComponentType = componentType;
const injector: Injector = Injector.create({providers: [], parent: this.angularContainer.viewContainerRef.injector/*this.containerRef.injector*/}); const injector: Injector = Injector.create({providers: [], parent: this.angularContainer.viewContainerRef.injector});
try { try {
/*this.containerRef*/this.angularContainer.viewContainerRef.createComponent(this.containerInstanceComponentType, this.angularContainer.viewContainerRef.createComponent(this.containerInstanceComponentType,
{index: 0, injector}); {index: 0, injector});
} catch (error) { } catch (error) {

Loading…
Cancel
Save