1
0
mirror of https://github.com/bitwarden/web synced 2025-12-15 07:43:16 +00:00

setComponentParameters for modal

This commit is contained in:
Kyle Spearrin
2019-07-25 12:24:32 -04:00
parent 55481b255b
commit 8f886df84f
2 changed files with 6 additions and 2 deletions

View File

@@ -25,12 +25,16 @@ export class ModalComponent extends BaseModalComponent {
ngOnDestroy() { /* Nothing */ }
show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true): T {
show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true,
setComponentParameters: (component: T) => void = null): T {
this.parentContainer = parentContainer;
this.fade = fade;
const factory = this.componentFactoryResolver.resolveComponentFactory<T>(type);
const componentRef = this.container.createComponent<T>(factory);
if (setComponentParameters != null) {
setComponentParameters(componentRef.instance);
}
const modals = Array.from(document.querySelectorAll('.modal'));
if (modals.length > 0) {