7
7
*/
8
8
9
9
import { ComponentType , Overlay , OverlayContainer , ScrollStrategy } from '@angular/cdk/overlay' ;
10
- import { Location } from '@angular/common' ;
10
+ import { DOCUMENT , Location } from '@angular/common' ;
11
11
import {
12
12
ANIMATION_MODULE_TYPE ,
13
13
ComponentRef ,
@@ -20,6 +20,7 @@ import {
20
20
SkipSelf ,
21
21
TemplateRef ,
22
22
Type ,
23
+ inject ,
23
24
} from '@angular/core' ;
24
25
import { MatDialogConfig } from './dialog-config' ;
25
26
import { _MatDialogContainerBase , MatDialogContainer } from './dialog-container' ;
@@ -76,6 +77,7 @@ export abstract class _MatDialogBase<C extends _MatDialogContainerBase> implemen
76
77
protected _idPrefix = 'mat-dialog-' ;
77
78
private _dialog : Dialog ;
78
79
protected dialogConfigClass = MatDialogConfig ;
80
+ private _document = inject ( DOCUMENT , { optional : true } ) ;
79
81
80
82
/** Keeps track of the currently-open dialogs. */
81
83
get openDialogs ( ) : MatDialogRef < any > [ ] {
@@ -196,6 +198,14 @@ export abstract class _MatDialogBase<C extends _MatDialogContainerBase> implemen
196
198
} ,
197
199
} ) ;
198
200
201
+ if ( ! ( componentOrTemplateRef instanceof TemplateRef ) ) {
202
+ const children = this . _document ?. querySelectorAll ( '.mat-mdc-dialog-surface > *' ) || [ ] ;
203
+ for ( let i = 0 ; i < children . length ; i ++ ) {
204
+ children [ i ] . classList . add ( 'mdc-dialog__surface' ) ;
205
+ children [ i ] . classList . add ( 'mat-mdc-dialog-surface' ) ;
206
+ }
207
+ }
208
+
199
209
// This can't be assigned in the `providers` callback, because
200
210
// the instance hasn't been assigned to the CDK ref yet.
201
211
( dialogRef ! as { componentRef : ComponentRef < T > } ) . componentRef = cdkRef . componentRef ! ;
0 commit comments