Display snackbar when submitting an alert

This commit is contained in:
Simon Hanna 2018-09-10 14:00:56 +02:00
parent 994367c147
commit 1949be3b73
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { OpenLPService } from '../../openlp.service';
import { MatSnackBar } from '@angular/material';
@Component({
selector: 'openlp-remote-alert',
@ -14,11 +15,11 @@ export class OpenLPAlertComponent {
public alert: string;
constructor(private openlpService: OpenLPService) { }
constructor(private openlpService: OpenLPService, private snackBar: MatSnackBar) { }
onSubmit() {
console.log('submitted: ', this.alert);
this.openlpService.showAlert(this.alert).subscribe(res => {});
this.openlpService.showAlert(this.alert).subscribe(res => this.snackBar.open('Alert submitted', '', {duration: 2000}));
this.alert = '';
}
}