Browse Source

web-ui: Add NotificationService

scalafmt-draft
Alexis Hernandez 7 years ago
parent
commit
222fd64a28
  1. 6
      web-ui/src/app/app.module.ts
  2. 22
      web-ui/src/app/services/notification.service.ts

6
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 { }

22
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);
}
}
Loading…
Cancel
Save