import { Component } from '@angular/core' ; import { MatSnackBar } from '@angular/material' ; title @ Component ( { selector : 'snack-bar-overview-example' , templateUrl : 'snack-bar-overview-example.html' , styleUrls : [ 'snack-bar-overview-example.css' ] , } ) export class SnackBarOverviewExample { constructor ( public snackBar ) { } openSnackBar ( message , action ) { this . snackBar . open ( message , action , { duration : 2000 , } ) ; } }