diff --git a/web-ui/src/app/app.module.ts b/web-ui/src/app/app.module.ts index 12cf568..9c194c9 100644 --- a/web-ui/src/app/app.module.ts +++ b/web-ui/src/app/app.module.ts @@ -13,6 +13,7 @@ import { ToastrModule } from 'ngx-toastr'; import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module' import { LanguageService } from './services/language.service'; +import { NotificationService } from './services/notification.service'; import { AppComponent } from './app.component'; import { HomeComponent } from './components/home/home.component'; @@ -47,7 +48,10 @@ import { TransactionFinderComponent } from './components/transaction-finder/tran NgHttpLoaderModule, TranslateModule.forRoot(), ], - providers: [LanguageService], + providers: [ + LanguageService, + NotificationService + ], bootstrap: [AppComponent] }) export class AppModule { } diff --git a/web-ui/src/app/services/notification.service.ts b/web-ui/src/app/services/notification.service.ts new file mode 100644 index 0000000..09cbf85 --- /dev/null +++ b/web-ui/src/app/services/notification.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; + +import { ToastrService } from 'ngx-toastr'; + +const toastrOptions = { + tapToDismiss: true, + positionClass: 'toast-top-center' +}; + +@Injectable() +export class NotificationService { + + constructor(private toastrService: ToastrService) { } + + info(message: string) { + this.toastrService.info(message, '', toastrOptions); + } + + error(message: string) { + this.toastrService.error(message, '', toastrOptions); + } +}