diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/services/modal.service.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/services/modal.service.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/services/modal.service.ts b/catalog-ui/src/app/ng2/services/modal.service.ts index 897571b5ee..27d679facb 100644 --- a/catalog-ui/src/app/ng2/services/modal.service.ts +++ b/catalog-ui/src/app/ng2/services/modal.service.ts @@ -110,6 +110,18 @@ export class ModalService { return modalInstance; } + public addDynamicContentToModalAndBindInputs = (modalInstance: ComponentRef<ModalComponent>, dynamicComponentType: Type<any>, + dynamicComponentInput?: Object) => { + + const dynamicContent = this.dynamicComponentService + .createDynamicComponent(dynamicComponentType, modalInstance.instance.dynamicContentContainer); + for (const key of Object.keys(dynamicComponentInput)) { + dynamicContent.instance[key] = dynamicComponentInput[key]; + } + modalInstance.instance.dynamicContent = dynamicContent; + return modalInstance; + } + public addDynamicTemplateToModal = (modalInstance: ComponentRef<ModalComponent>, templateRef: TemplateRef<void>) => { modalInstance.instance.dynamicContentContainer.clear(); modalInstance.instance.dynamicContentContainer.createEmbeddedView(templateRef); |