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