title: How to obtain data property from MatSnackBarConfig
body: <p>I've read in the <a href="https://material.angular.io/components/snack-bar/api" rel="noreferrer">documentation</a>, that <code>MatSnackBarConfig</code> object could have a <code>data</code> property which represents </p>
  
  <blockquote>
    <p>Data being injected into the child component.</p>
  </blockquote>
  
  <p>So I guess  I can use those data inside a custom snack-bar opened via <code>openFromComponent</code> method. The question is can I do that? If yes, then how can I do that?</p>
  
  <p>Having <a href="https://stackblitz.com/angular/mjolryoarpy" rel="noreferrer">an example</a> provided in the documentation, let's say I modify the <code>openSnackBar</code> method to the following:</p>
  
  <p><strong>app/snack-bar-component-example.ts</strong></p>
  
  <pre><code>openSnackBar() {
    this.snackBar.openFromComponent(PizzaPartyComponent, {
      duration: 500, data: {message: 'Hello World!'}
    });
  }
  </code></pre>
  
  <p>Now, how could I obtain the <code>data</code> object within the <code>PizzaPartyComponent</code>?
  I've tried to inject it to the component's constructor but it couldn't be resolved.</p>
  
  <pre><code>//below code results in error
  
  export class PizzaPartyComponent {
    constructor(private data: any) { 
      console.log(data); 
    }
  }
  </code></pre>