Open mrentmeister-tt opened 3 weeks ago
@mrentmeister-tt
From the code excerpts provided I can see you have a TraxDialogService
. It is look like you can show any component via this service and you provide the DialogSettings
before you show the component in the overlay. The question here is do you dynamically change the DialogSettings
each time the component is shown on the overlay service?
If you can provide more information about how exactly you are showing the components via TraxDialogService
we will investigate how you can achieve what you need.
@wnvko No, the dialog settings are not changed after a component is opened via the dialog service. It's intended to be a short-lived modal service where I can return a result to the component that opens the modal. I have updated the source code in the description. Below is an example of how it's used:
checkForUnsavedChangesAsync(key: string): Promise<DialogResults> {
return new Promise<DialogResults>(resolve => {
if (!this.isDirty()) {
return resolve(DialogResults.None);
}
const dialogRef = this._dialogService.open(AlertDialogComponent, {
dimensions: { minWidth: '32rem', maxWidth: '70rem' },
data: {
buttons: AlertDialogButtons.SaveDiscardCancel,
title: $localize`:@@saveChanges:Save changes`,
description: $localize`:@@discardUnsavedChanges:There are unsaved changes. You can Discard your changes, or close this message to continue editing.`,
type: AlertDialogType.Confirm
}
});
dialogRef.closed$.pipe(first()).subscribe({
next: (result: DialogResults = DialogResults.None) => {
switch (result) {
case DialogResults.Cancel:
break;
case DialogResults.None:
// They clicked outside of the modal, cancel the action
result = DialogResults.Cancel;
break;
case DialogResults.Save:
// They can only get here if the form is valid
this.manager.onSave();
break;
default:
this.manager.onDiscard();
break;
}
resolve(result);
}
});
});
}
Another example would be displaying a table in a modal, where the user selects a row, and then the row is returned as a result.
Description
I just recently updated from igniteui-angular v17.2.4 to 18.0.0. In the new version, I lost the ability to provide an injector when creating a component in an overlay. I use it to provide things like data and settings to the component that's created (similar to matdialog). I looked at the attach function in the OverlayService (https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/services/overlay/overlay.ts#L323) to see that you're using createComponent and viewContainerRef.createComponent. These functions also support an option to provide an element injector,
This is a mix between a feature request and a bug, because it did work in previous versions, but lost support due to api changes. The feature request portion is to add injector as an optional parameter to OverlaySettings.
Excerpts from my code pre v18
Expected result
OverlayService should support providing a custom injector like before, perhaps via OverlaySettings.
Attachments
Attach a sample if available, and screenshots, if applicable.