Currently, I am in the process of developing a dialog service that will showcase a wrapper component whose parameter is a component to be displayed as the content of the wrapper.
open(component: any | TemplateRef<any>, params, viewMode: ViewMode = ViewMode.EDIT, className: string[] = ['as-dialog', 'as-dialog-large']): Observable<any> {
// Need to find a way to nest the component in AsDialogWrapperComponent
// and then display AsDialogWrapperComponent with the nested component as its content
this.dialogRef = this.matDialog.open(AsDialogWrapperComponent, {
data: {
params,
viewMode
},
panelClass: className
});
return this.dialogRef.afterClosed();
}
The code for the wrapper would look like this:
<div class="as-box as-vertical as-fh">
<div class="as-dialog-header">
<p class="as-dialog-header-text" mat-dialog-title #title></p>
</div>
<mat-dialog-content #content></mat-dialog-content>
</div>
I am interested in finding a way to nest the component provided as a parameter. I have attempted using the componentFactoryResolver, but was unable to resolve it in the end.
This functionality is necessary because some views can be both modals and full-screen views. Therefore, a modal wrapper that accepts a title as a parameter and modal actions either as parameters or within a custom button bar could be utilized.
Any advice or tips on how to achieve this nesting would be greatly appreciated. Thank you.