title: Cannot read property 'ngMetadataName' of undefined
body: <p>I am using Angular 6 with Angular Material. After updating to the latest version, the console is throwing this error in development. <strong>On Production it is working</strong></p>
  
  <p><code>Cannot read property 'ngMetadataName' of undefined</code></p>
  
  <p>It occurs when I am trying to open material dialog via a service ( without a service they are working fine). I think it is related to the Injectables, but I am not sure. </p>
  
  <p><strong>Versions: cli: 6.1.5 , core: 6.1.4, material: 6.4.6</strong></p>
  
  <p>Here is the log stack:</p>
  
  <pre><code>CustomDialogComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'ngMetadataName' of undefined
  at injectArgs (core.js:1418)
  at core.js:1491
  at _callFactory (core.js:8438)
  at _createProviderInstance (core.js:8396)
  at resolveNgModuleDep (core.js:8371)
  at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9064)
  at PortalInjector.push../node_modules/@angular/cdk/esm5/portal.es5.js.PortalInjector.get (portal.es5.js:732)
  at resolveDep (core.js:9419)
  at createClass (core.js:9309)
  at createDirectiveInstance (core.js:9186)
  </code></pre>
  
  <p>Any assistance will be appreciated. </p>
  
  <p>dialog inside the service, where the error is thrown :</p>
  
  <pre><code> @Injectable({
    providedIn: 'root'
  })
  export class customService {
    constructor(private store: Store&lt;RootState&gt;, private dialog: MatDialog) {}
  
  const dialogRef = this.dialog.open(customDialogComponent, {
    width: '300px',
    data: {
      loading: false,
      customId,
    }
  });
  </code></pre>