@@ -17,6 +17,7 @@ import {
17
17
Inject ,
18
18
Optional ,
19
19
ChangeDetectorRef ,
20
+ ChangeDetectionStrategy ,
20
21
} from '@angular/core' ;
21
22
import {
22
23
animate ,
@@ -51,6 +52,7 @@ export function throwMdDialogContentAlreadyAttachedError() {
51
52
templateUrl : 'dialog-container.html' ,
52
53
styleUrls : [ 'dialog.css' ] ,
53
54
encapsulation : ViewEncapsulation . None ,
55
+ changeDetection : ChangeDetectionStrategy . OnPush ,
54
56
animations : [
55
57
trigger ( 'slideDialog' , [
56
58
// Note: The `enter` animation doesn't transition to something like `translate3d(0, 0, 0)
@@ -118,7 +120,13 @@ export class MdDialogContainer extends BasePortalHost {
118
120
}
119
121
120
122
this . _savePreviouslyFocusedElement ( ) ;
121
- return this . _portalHost . attachComponentPortal ( portal ) ;
123
+
124
+ const componentRef = this . _portalHost . attachComponentPortal ( portal ) ;
125
+
126
+ // Ensure that the initial view change are picked up.
127
+ componentRef . changeDetectorRef . markForCheck ( ) ;
128
+
129
+ return componentRef ;
122
130
}
123
131
124
132
/**
@@ -131,7 +139,12 @@ export class MdDialogContainer extends BasePortalHost {
131
139
}
132
140
133
141
this . _savePreviouslyFocusedElement ( ) ;
134
- return this . _portalHost . attachTemplatePortal ( portal ) ;
142
+
143
+ const locals = this . _portalHost . attachTemplatePortal ( portal ) ;
144
+
145
+ this . _changeDetectorRef . markForCheck ( ) ;
146
+
147
+ return locals ;
135
148
}
136
149
137
150
/** Moves the focus inside the focus trap. */
0 commit comments