Skip to content

Commit 8c568aa

Browse files
committed
main - 1dc6b44 docs(material/dialog): clarify that default options replace rather than merge (#32819)
1 parent 217766b commit 8c568aa

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

docs-content/overviews/cdk/dialog/dialog.md.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ <h3 id="specifying-global-configuration-defaults" class="docs-header-link">
109109
<span class="hljs-attr">providers</span>: [
110110
{<span class="hljs-attr">provide</span>: <span class="hljs-variable constant_">DEFAULT_DIALOG_CONFIG</span>, <span class="hljs-attr">useValue</span>: {<span class="hljs-attr">hasBackdrop</span>: <span class="hljs-literal">false</span>}}
111111
]
112-
});</code></pre>
112+
});</code></pre><blockquote>
113+
<p><strong>Note:</strong> The value provided for <code>DEFAULT_DIALOG_CONFIG</code> <strong>replaces</strong> the built-in defaults
114+
entirely rather than merging with them. For example, providing <code>{disableClose: true}</code> means that
115+
all other defaults (such as <code>hasBackdrop</code>) will be <code>undefined</code>. If you only want to override
116+
specific properties, spread the defaults first:</p>
117+
<pre><code class="language-ts">{<span class="hljs-attr">provide</span>: <span class="hljs-variable constant_">DEFAULT_DIALOG_CONFIG</span>, <span class="hljs-attr">useValue</span>: {...<span class="hljs-keyword">new</span> <span class="hljs-title class_">DialogConfig</span>(), <span class="hljs-attr">disableClose</span>: <span class="hljs-literal">true</span>}}</code></pre><p>When you call <code>dialog.open()</code> with a config, that config is merged on top of these defaults, so
118+
per-dialog options always take precedence.</p>
119+
</blockquote>
120+
113121
<h3 id="sharing-data-with-the-dialog-component" class="docs-header-link">
114122
<span header-link="sharing-data-with-the-dialog-component"></span>
115123
Sharing data with the Dialog component.

docs-content/overviews/material/dialog/dialog.md.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ <h3 id="specifying-global-configuration-defaults" class="docs-header-link">
3636
<span class="hljs-attr">providers</span>: [
3737
{<span class="hljs-attr">provide</span>: <span class="hljs-variable constant_">MAT_DIALOG_DEFAULT_OPTIONS</span>, <span class="hljs-attr">useValue</span>: {<span class="hljs-attr">hasBackdrop</span>: <span class="hljs-literal">false</span>}}
3838
]
39-
});</code></pre>
39+
});</code></pre><blockquote>
40+
<p><strong>Note:</strong> The value provided for <code>MAT_DIALOG_DEFAULT_OPTIONS</code> <strong>replaces</strong> the built-in defaults
41+
entirely rather than merging with them. For example, providing <code>{disableClose: true}</code> means that
42+
all other defaults (such as <code>hasBackdrop</code>) will be <code>undefined</code>. If you only want to override
43+
specific properties, spread the defaults first:</p>
44+
<pre><code class="language-ts">{<span class="hljs-attr">provide</span>: <span class="hljs-variable constant_">MAT_DIALOG_DEFAULT_OPTIONS</span>, <span class="hljs-attr">useValue</span>: {...<span class="hljs-keyword">new</span> <span class="hljs-title class_">MatDialogConfig</span>(), <span class="hljs-attr">disableClose</span>: <span class="hljs-literal">true</span>}}</code></pre><p>When you call <code>dialog.open()</code> with a config, that config is merged on top of these defaults, so
45+
per-dialog options always take precedence.</p>
46+
</blockquote>
47+
4048
<h3 id="sharing-data-with-the-dialog-component" class="docs-header-link">
4149
<span header-link="sharing-data-with-the-dialog-component"></span>
4250
Sharing data with the Dialog component.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular/components-examples",
3-
"version": "22.0.0-next.3+sha-8473a27",
3+
"version": "22.0.0-next.3+sha-1dc6b44",
44
"description": "Angular Components Examples",
55
"private": true,
66
"repository": {
@@ -255,15 +255,15 @@
255255
},
256256
"homepage": "https://github.com/angular/components#readme",
257257
"peerDependencies": {
258-
"@angular/aria": "22.0.0-next.3+sha-8473a27",
259-
"@angular/cdk": "22.0.0-next.3+sha-8473a27",
260-
"@angular/cdk-experimental": "22.0.0-next.3+sha-8473a27",
258+
"@angular/aria": "22.0.0-next.3+sha-1dc6b44",
259+
"@angular/cdk": "22.0.0-next.3+sha-1dc6b44",
260+
"@angular/cdk-experimental": "22.0.0-next.3+sha-1dc6b44",
261261
"@angular/core": "^22.0.0-0 || ^22.1.0-0 || ^22.2.0-0 || ^22.3.0-0 || ^23.0.0-0",
262262
"@angular/common": "^22.0.0-0 || ^22.1.0-0 || ^22.2.0-0 || ^22.3.0-0 || ^23.0.0-0",
263-
"@angular/material": "22.0.0-next.3+sha-8473a27",
264-
"@angular/material-experimental": "22.0.0-next.3+sha-8473a27",
265-
"@angular/material-luxon-adapter": "22.0.0-next.3+sha-8473a27",
266-
"@angular/material-date-fns-adapter": "22.0.0-next.3+sha-8473a27"
263+
"@angular/material": "22.0.0-next.3+sha-1dc6b44",
264+
"@angular/material-experimental": "22.0.0-next.3+sha-1dc6b44",
265+
"@angular/material-luxon-adapter": "22.0.0-next.3+sha-1dc6b44",
266+
"@angular/material-date-fns-adapter": "22.0.0-next.3+sha-1dc6b44"
267267
},
268268
"devDependencies": {
269269
"@angular/aria": "workspace:*",

0 commit comments

Comments
 (0)