title: Error: No component factory found for MatSnackBarContainer
body: <p>I've started a simple angular material project and trying to display the Snack-bar on page load. But it is throwing following error:-</p>
  
  <blockquote>
    <p>ERROR Error: No component factory found for MatSnackBarContainer. Did you add 
        it to @NgModule.entryComponents?</p>
  </blockquote>
  
  <p>I've even included AppComponent in entry component list in <code>app.module.ts</code> but it is not working. </p>
  
  <p>Here's my app.component.html:-</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { MatSnackBar } from '@angular/material';
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css'],
    providers: [MatSnackBar]
  })
  export class AppComponent {
    title = 'snackbarapp';
  
    constructor(public snackBar: MatSnackBar) {
      this.snackBar.open('hello', 'world', { duration: 2000 });
    }
  }
  </code></pre>
  
  <p>Here is app.module.ts:-</p>
  
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  
  import { AppComponent } from './app.component';
  import { MatSnackBar } from '@angular/material';
  import { Overlay } from '@angular/cdk/overlay';
  
  @NgModule({
    declarations: [AppComponent],
    imports: [BrowserModule ],
    entryComponents: [AppComponent],
    providers: [MatSnackBar, Overlay],
    bootstrap: [AppComponent]
  })
  export class AppModule {}
  </code></pre>
  
  <p>I've following dependencies:-</p>
  
  <pre><code> "dependencies": {
      "@angular/animations": "^6.1.10",
      "@angular/cdk": "^7.2.0",
      "@angular/common": "^6.1.0",
      "@angular/compiler": "^6.1.0",
      "@angular/core": "^6.1.0",
      "@angular/forms": "^6.1.0",
      "@angular/http": "^6.1.0",
      "@angular/material": "^7.2.0",
      "@angular/platform-browser": "^6.1.0",
      "@angular/platform-browser-dynamic": "^6.1.0",
      "@angular/router": "^6.1.0",
      "core-js": "^2.5.4",
      "rxjs": "^6.0.0",
      "zone.js": "~0.8.26"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "~0.7.0",
      "@angular/cli": "~6.1.5",
      "@angular/compiler-cli": "^6.1.0",
      "@angular/language-service": "^6.1.0",
      "@types/jasmine": "~2.8.6",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "~8.9.4",
      "codelyzer": "~4.2.1",
      "jasmine-core": "~2.99.1",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~1.7.1",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.0",
      "karma-jasmine": "~1.1.1",
      "karma-jasmine-html-reporter": "^0.2.2",
      "protractor": "~5.4.0",
      "ts-node": "~5.0.1",
      "tslint": "~5.9.1",
      "typescript": "~2.7.2"
    }
  </code></pre>
  
  <p>How to fix it?</p>