1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

Add support for setting up component factory resolvers in modal service (#471)

This commit is contained in:
Oscar Hinton
2021-08-31 16:35:20 +02:00
committed by GitHub
parent 30419a625f
commit d50531886b
2 changed files with 21 additions and 3 deletions

View File

@@ -2,7 +2,6 @@ import {
AfterViewInit,
ChangeDetectorRef,
Component,
ComponentFactoryResolver,
ComponentRef,
ElementRef,
OnDestroy,
@@ -11,6 +10,8 @@ import {
ViewContainerRef
} from '@angular/core';
import { ModalService } from '../../services/modal.service';
import { ModalRef } from './modal.ref';
@Component({
@@ -25,7 +26,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
childComponentType: Type<any>;
setComponentParameters: (component: any) => void;
constructor(private componentFactoryResolver: ComponentFactoryResolver, private cd: ChangeDetectorRef,
constructor(private modalService: ModalService, private cd: ChangeDetectorRef,
private el: ElementRef<HTMLElement>, public modalRef: ModalRef) {}
ngAfterViewInit() {
@@ -39,7 +40,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
}
loadChildComponent(componentType: Type<any>) {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentType);
const componentFactory = this.modalService.resolveComponentFactory(componentType);
this.modalContentRef.clear();
this.componentRef = this.modalContentRef.createComponent(componentFactory);