title: How to emit event when using snack-bar (entryComponents) in angular2
body: <p>Here I had a method 'confirmSth', loaded a component 'SnackCheckBoxComponent' dynamically.</p>
  
  <p>I would like to know If I can get some msg in my OrderDetailComponent to distinguish which button from SnackCheckBoxComponent i clicked so to decide 
   the confirmSth return true or false.</p>
  
  <pre><code>//...
  import { MdSnackBar, MdSnackBarRef } from '@angular/material';
  
  export class OrderDetailComponent {
  
    constructor(public snackBar: MdSnackBar) {
  
    confirmSth(): boolean {
  
      // ...condition
      if (condition) return true
  
      this.snackBarRef = this.snackBar.openFromComponent(SnackCheckBoxComponent, { duration: 50000 })
      this.snackBarRef.instance.snackBarRefCheckComponent = this.snackBarRef
  
      // I would like to know If I can get some msg here to distinguish which button i clicked so to decide return true or false.
  
    }
  
  }
  
  @Component({
    selector: 'snack-check-box',
    templateUrl: './snack-check-box.html',
    styleUrls: ['./snack-check-box.css'],
  })
  export class SnackCheckBoxComponent {
    public snackBarRefCheckComponent: MdSnackBarRef&lt;SnackCheckBoxComponent&gt;
  
    private onCancel() {
      alert('clicked option 1');
      this.snackBarRefCheckComponent.dismiss();
    }
  
    private onSubmit() {
      alert('clicked option 2');
      this.snackBarRefCheckComponent.dismiss();
    }
  }
  </code></pre>
  
  <p>here is my './snack-check-box.html'</p>
  
  <pre><code>&lt;span&gt;overloaded, whether to continue xxx&lt;/span&gt;
  
  &lt;a (click)="onSubmit()"&gt;yes&lt;/a&gt;
  &lt;a (click)="onCancel()"&gt;no&lt;/a&gt;
  </code></pre>