Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-08-20 14:19:57 +03:00
parent 6d5ab6f208
commit eb4daf33f1
83 changed files with 2726 additions and 2116 deletions

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MessageService } from './message.service';
describe('MessageService', () => {
let message: MessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
message = TestBed.inject(MessageService);
});
it('should be created', () => {
expect(message).toBeTruthy();
});
});

View File

@@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@Injectable({
providedIn: 'root'
})
export class MessageService {
constructor(
private snackbar: MatSnackBar,
) {
}
showMessage(message: string, action?: string, config?: MatSnackBarConfig) {
let cfg = config
if (!cfg) {
cfg = { duration: 2000 }
}
this.snackbar.open(message, action, cfg);
}
}