Hide snackbar on navigate (CC-81)
parent
2fffad3c60
commit
9de759805a
|
@ -11,6 +11,7 @@ import {SpinnerService} from './services/user-interface/spinner/spinner.service'
|
||||||
import {TranslateService} from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {SettingsService} from './services/settings.service';
|
import {SettingsService} from './services/settings.service';
|
||||||
import {environment} from '../environments/environment';
|
import {environment} from '../environments/environment';
|
||||||
|
import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
|
||||||
declare function require(url: string);
|
declare function require(url: string);
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ export class AppComponent implements OnInit {
|
||||||
private spinnerService: SpinnerService,
|
private spinnerService: SpinnerService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
|
private snackBarService: SnackBarService,
|
||||||
@Inject(DOCUMENT) private document) {
|
@Inject(DOCUMENT) private document) {
|
||||||
this.initMaterialSvgIcons();
|
this.initMaterialSvgIcons();
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ export class AppComponent implements OnInit {
|
||||||
router.events.subscribe(event => {
|
router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
this.spinnerService.activate();
|
this.spinnerService.activate();
|
||||||
|
this.snackBarService.dismiss();
|
||||||
}
|
}
|
||||||
if (event instanceof NavigationEnd) {
|
if (event instanceof NavigationEnd) {
|
||||||
this.spinnerService.deactivate();
|
this.spinnerService.deactivate();
|
||||||
|
|
|
@ -29,6 +29,10 @@ export class SnackBarService {
|
||||||
return this.snackbar.open(message, action, config);
|
return this.snackbar.open(message, action, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dismiss() {
|
||||||
|
this.snackbar.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
showSuccess(i18n: string) {
|
showSuccess(i18n: string) {
|
||||||
this.translate.get(i18n).subscribe((translated) => {
|
this.translate.get(i18n).subscribe((translated) => {
|
||||||
return this.show(translated, undefined, 2500, ['custom-snack-bar', 'label-success']);
|
return this.show(translated, undefined, 2500, ['custom-snack-bar', 'label-success']);
|
||||||
|
|
Loading…
Reference in New Issue