title: In angular 9 dialog material is render as blank in left end
body: <p>I need a help on mat dialog render on screen.
  adding the steps which i followed to perform this action below.</p>
  
  <p>The packages installed in the project is</p>
  
  <pre><code>Package                           Version
  -----------------------------------------------------------
  @angular-devkit/architect         0.900.7
  @angular-devkit/build-angular     0.900.7
  @angular-devkit/build-optimizer   0.900.7
  @angular-devkit/build-webpack     0.900.7
  @angular-devkit/core              9.0.7
  @angular-devkit/schematics        9.0.7
  @angular/cdk                      6.4.7
  @angular/flex-layout              9.0.0-beta.29-7a22fba
  @angular/material                 6.4.7
  @ngtools/webpack                  9.0.7
  @schematics/angular               9.0.7
  @schematics/update                0.900.7
  rxjs                              6.5.5
  typescript                        3.7.5
  webpack                           4.41.2
  </code></pre>
  
  <p><strong>Next created login component</strong> </p>
  
  <p>html file</p>
  
  <pre><code>&lt;mat-toolbar color="primary"&gt;
          Login 
        &lt;span class="flex-spacer"&gt;&lt;/span&gt;
        &lt;button mat-button mat-dialog-close&gt;&amp;times;&lt;/button&gt;
      &lt;/mat-toolbar&gt;
  </code></pre>
  
  <p>Ts file</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import {MatDialog, MatDialogRef} from '@angular/material';
  @Component({
    selector: 'app-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.scss']
  })
  export class LoginComponent implements OnInit {
  
    constructor(public dialogRef: MatDialogRef&lt;LoginComponent&gt;) { }
  
    ngOnInit(): void {
    }
  
  }
  </code></pre>
  
  <p><strong>Then i have included in header component</strong> </p>
  
  <p>html code</p>
  
  <pre><code>&lt;a mat-button (click)="openLoginForm()"&gt;&lt;span class="fa fa-sign-in fa-lg"&gt;&lt;/span&gt; Login&lt;/a&gt;
  </code></pre>
  
  <p>Ts code</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { MatDialog, MatDialogRef } from '@angular/material';
  import { LoginComponent } from '../login/login.component';
  @Component({
    selector: 'app-header',
    templateUrl: './header.component.html',
    styleUrls: ['./header.component.scss']
  })
  export class HeaderComponent implements OnInit {
  constructor(public dialog: MatDialog ) { }
  
    ngOnInit() {
    }
  
    openLoginForm() {
      this.dialog.open(LoginComponent, {width: '500px', height: '450px'});
    }
  
  }
  </code></pre>
  
  <p><strong>Called in app module</strong></p>
  
  <pre><code>....
  import { MatDialogModule } from '@angular/material/dialog';
  import { LoginComponent } from './login/login.component';
  ....
  @NgModule({
    declarations: [
  ...
    LoginComponent
    ],
  imports: [
  ...
  MatDialogModule,
    ],
   entryComponents: [LoginComponent],
    providers: [],
    bootstrap: [AppComponent],
  
  })
  </code></pre>
  
  <p>The dialog comes as empty at the left corner while clicking</p>
  
  <p><a href="https://i.stack.imgur.com/Uo4Mg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uo4Mg.png" alt="enter image description here"></a></p>
  
  <p>Also the console error is below</p>
  
  <pre><code>ERROR TypeError: Cannot read property 'hasAttached' of undefined
      at MatDialogContainer.attachComponentPortal (dialog.js:170)
      at MatDialog._attachDialogContent (dialog.js:708)
      at MatDialog.open (dialog.js:603)
      at HeaderComponent.openLoginForm (header.component.ts:16)
      at HeaderComponent_Template_a_click_16_listener (header.component.html:8)
      at executeListenerWithErrorHandling (core.js:21693)
      at wrapListenerIn_markDirtyAndPreventDefault (core.js:21742)
      at HTMLAnchorElement.&lt;anonymous&gt; (platform-browser.js:934)
      at ZoneDelegate.invokeTask (zone-evergreen.js:399)
      at Object.onInvokeTask (core.js:41264)
  </code></pre>
  
  <p>Please some one help on this issue.</p>