[DURACOM-191] fix dynamicComponentLoader

This commit is contained in:
Andrea Barbasso
2024-03-07 15:41:37 +01:00
parent a8b4c82b9a
commit 19f806caf2
3 changed files with 9 additions and 5 deletions

View File

@@ -1 +1 @@
<ng-template dsDynamicComponentLoader></ng-template>
<ng-template #DynamicComponentLoader dsDynamicComponentLoader></ng-template>

View File

@@ -19,13 +19,17 @@ import { DynamicComponentLoaderDirective } from './dynamic-component-loader.dire
@Component({
selector: 'ds-abstract-component-loader',
templateUrl: './abstract-component-loader.component.html',
standalone: true,
imports: [
DynamicComponentLoaderDirective,
]
})
export abstract class AbstractComponentLoaderComponent<T> implements OnInit, OnChanges, OnDestroy {
/**
* Directive to determine where the dynamic child component is located
*/
@ViewChild(DynamicComponentLoaderDirective, { static: true }) componentDirective: DynamicComponentLoaderDirective;
@ViewChild('DynamicComponentLoader', { static: true, read: ViewContainerRef }) componentViewContainerRef: ViewContainerRef;
/**
* The reference to the dynamic component
@@ -94,7 +98,7 @@ export abstract class AbstractComponentLoaderComponent<T> implements OnInit, OnC
public instantiateComponent(): void {
const component: GenericConstructor<T> = this.getComponent();
const viewContainerRef: ViewContainerRef = this.componentDirective.viewContainerRef;
const viewContainerRef: ViewContainerRef = this.componentViewContainerRef;
viewContainerRef.clear();
this.compRef = viewContainerRef.createComponent(

View File

@@ -11,7 +11,7 @@ import { RouterLink } from '@angular/router';
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
import { ThemedLangSwitchComponent } from 'src/app/shared/lang-switch/themed-lang-switch.component';
import { Observable } from 'rxjs';
import { AsyncPipe } from '@angular/common';
import { AsyncPipe, NgIf } from '@angular/common';
/**
* Represents the header with the logo and simple navigation
@@ -21,7 +21,7 @@ import { AsyncPipe } from '@angular/common';
styleUrls: ['header.component.scss'],
templateUrl: 'header.component.html',
standalone: true,
imports: [NgbDropdownModule, ThemedLangSwitchComponent, RouterLink, ThemedSearchNavbarComponent, LangSwitchComponent, ContextHelpToggleComponent, ThemedAuthNavMenuComponent, ImpersonateNavbarComponent, ThemedNavbarComponent, TranslateModule, AsyncPipe]
imports: [NgbDropdownModule, ThemedLangSwitchComponent, RouterLink, ThemedSearchNavbarComponent, LangSwitchComponent, ContextHelpToggleComponent, ThemedAuthNavMenuComponent, ImpersonateNavbarComponent, ThemedNavbarComponent, TranslateModule, AsyncPipe, NgIf]
})
export class HeaderComponent extends BaseComponent implements OnInit {
public isNavBarCollapsed$: Observable<boolean>;