File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,16 +117,28 @@ class MyDialogContainer extends CdkDialogContainer {}
117117
118118### Specifying global configuration defaults
119119Default dialog options can be specified by providing an instance of ` DialogConfig ` for
120- ` DEFAULT_DIALOG_CONFIG ` in your application's root module .
120+ ` DEFAULT_DIALOG_CONFIG ` in your app config .
121121
122122``` ts
123- @ NgModule ( {
123+ bootstrapApplication ( MyApp , {
124124 providers: [
125125 {provide: DEFAULT_DIALOG_CONFIG , useValue: {hasBackdrop: false }}
126126 ]
127- })
127+ });
128128```
129129
130+ > ** Note:** The value provided for ` DEFAULT_DIALOG_CONFIG ` ** replaces** the built-in defaults
131+ > entirely rather than merging with them. For example, providing ` {disableClose: true} ` means that
132+ > all other defaults (such as ` hasBackdrop ` ) will be ` undefined ` . If you only want to override
133+ > specific properties, spread the defaults first:
134+ >
135+ > ``` ts
136+ > {provide: DEFAULT_DIALOG_CONFIG , useValue: {... new DialogConfig (), disableClose: true }}
137+ > ` ` `
138+ >
139+ > When you call ` dialog .open ()` with a config, that config is merged on top of these defaults, so
140+ > per-dialog options always take precedence.
141+
130142### Sharing data with the Dialog component.
131143You can use the ` data ` option to pass information to the dialog component.
132144
Original file line number Diff line number Diff line change @@ -41,16 +41,28 @@ export class YourDialog {
4141
4242### Specifying global configuration defaults
4343Default dialog options can be specified by providing an instance of ` MatDialogConfig ` for
44- MAT_DIALOG_DEFAULT_OPTIONS in your application's root module .
44+ MAT_DIALOG_DEFAULT_OPTIONS in your app config .
4545
4646``` ts
47- @ NgModule ( {
47+ bootstrapApplication ( MyApp , {
4848 providers: [
4949 {provide: MAT_DIALOG_DEFAULT_OPTIONS , useValue: {hasBackdrop: false }}
5050 ]
51- })
51+ });
5252```
5353
54+ > ** Note:** The value provided for ` MAT_DIALOG_DEFAULT_OPTIONS ` ** replaces** the built-in defaults
55+ > entirely rather than merging with them. For example, providing ` {disableClose: true} ` means that
56+ > all other defaults (such as ` hasBackdrop ` ) will be ` undefined ` . If you only want to override
57+ > specific properties, spread the defaults first:
58+ >
59+ > ``` ts
60+ > {provide: MAT_DIALOG_DEFAULT_OPTIONS , useValue: {... new MatDialogConfig (), disableClose: true }}
61+ > ` ` `
62+ >
63+ > When you call ` dialog .open ()` with a config, that config is merged on top of these defaults, so
64+ > per-dialog options always take precedence.
65+
5466### Sharing data with the Dialog component.
5567If you want to share data with your dialog, you can use the ` data `
5668option to pass information to the dialog component.
You can’t perform that action at this time.
0 commit comments