-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(material/dialog): add documentation for MAT_DIALOG_DEFAULT_OPTIONS #20631
Comments
This seems to be working, here's a stackblitz showing it: https://stackblitz.com/edit/angular-dxw9c8?file=src/main.ts |
Please try to click on "Open Dialog" button when your popup is already opened:
|
There is no automatic merging of your override with the default options. If you want to keep the rest of the default options just merge them when providing the value: {
...new MatDialogConfig(),
disableClose: true,
} See: https://stackblitz.com/edit/angular-dxw9c8-2sxvwj?file=src%2Fmain.ts |
why then such automatic merging is happening when the configs are provided in the .open() method? |
When you call |
I understand that, however in the official documentation there is no info provided for the case when the custom config is provided in the module, you can figure that out only when investigating the source code, I think would be better to somehow include that aspect, it is not intuitive. |
Reproduction
Steps to reproduce:
{
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: {
disableClose: true,
},
},
Expected Behavior
What behavior were you expecting to see?
Configs should be set along with the default values for the other options. Such behaviour can be seen when provided in the component with dialog.open() method
Actual Behavior
What behavior did you actually see?
Given configs overwrite the Configs value, so that default options are also overwritten.
Environment
The text was updated successfully, but these errors were encountered: