@@ -17,6 +17,7 @@ import {
1717 Inject ,
1818 Optional ,
1919 ChangeDetectorRef ,
20+ ChangeDetectionStrategy ,
2021} from '@angular/core' ;
2122import {
2223 animate ,
@@ -51,6 +52,7 @@ export function throwMdDialogContentAlreadyAttachedError() {
5152 templateUrl : 'dialog-container.html' ,
5253 styleUrls : [ 'dialog.css' ] ,
5354 encapsulation : ViewEncapsulation . None ,
55+ changeDetection : ChangeDetectionStrategy . OnPush ,
5456 animations : [
5557 trigger ( 'slideDialog' , [
5658 // Note: The `enter` animation doesn't transition to something like `translate3d(0, 0, 0)
@@ -118,7 +120,13 @@ export class MdDialogContainer extends BasePortalHost {
118120 }
119121
120122 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 ;
122130 }
123131
124132 /**
@@ -131,7 +139,12 @@ export class MdDialogContainer extends BasePortalHost {
131139 }
132140
133141 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 ;
135148 }
136149
137150 /** Moves the focus inside the focus trap. */
0 commit comments