snackbar.service.ts 411 Bytes
Newer Older
Lukas Burgey's avatar
Lukas Burgey committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import { Injectable } from '@angular/core';

import { MatSnackBar, MatSnackBarConfig } from '@angular/material';

@Injectable()
export class SnackBarService {
  config = new MatSnackBarConfig()

  constructor(
    public snackBar: MatSnackBar,
  ) {
    this.config.duration = 3000;
  }

  public open(message: string) {
16

17
    console.log(message);
Lukas Burgey's avatar
Lukas Burgey committed
18 19 20
    return this.snackBar.open(message, '', this.config);
  }
}