title: How can I set duration of a snack-bar in angular2 (material2)
body: <p>This example stays forever on the screen: </p>
  
  <p><a href="https://github.com/angular/material2/blob/master/src/demo-app/snack-bar/snack-bar-demo.ts" rel="noreferrer">snack-bar-demo.ts</a></p>
  
  <pre class="lang-js prettyprint-override"><code>import {Component, ViewContainerRef} from '@angular/core';
  import {MdSnackBar, MdSnackBarConfig} from '@angular/material';
  
  @Component({
    moduleId: module.id,
    selector: 'snack-bar-demo',
    templateUrl: 'snack-bar-demo.html',
  })
  export class SnackBarDemo {
    message: string = 'Snack Bar opened.';
    actionButtonLabel: string = 'Retry';
    action: boolean = false;
  
    constructor(
        public snackBar: MdSnackBar,
        public viewContainerRef: ViewContainerRef) { }
  
    open() {
      let config = new MdSnackBarConfig(this.viewContainerRef);
      this.snackBar.open(this.message, this.action &amp;&amp; this.actionButtonLabel, config);
    }
  }
  </code></pre>
  
  <p><strong>How can I make it disappear after 2 seconds (set duration/timeout somehow)?</strong></p>