From 1e2461c8c94d7b0e907d253daf7e5e6505841748 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Sun, 11 Mar 2018 12:56:05 -0600 Subject: [PATCH] web-ui: Add NavigatorService --- web-ui/src/app/app.module.ts | 2 ++ web-ui/src/app/services/navigator.service.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 web-ui/src/app/services/navigator.service.ts diff --git a/web-ui/src/app/app.module.ts b/web-ui/src/app/app.module.ts index 283ca0d..6637fb0 100644 --- a/web-ui/src/app/app.module.ts +++ b/web-ui/src/app/app.module.ts @@ -14,6 +14,7 @@ import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module' import { ErrorService } from './services/error.service'; import { LanguageService } from './services/language.service'; +import { NavigatorService } from './services/navigator.service'; import { NotificationService } from './services/notification.service'; import { TransactionsService } from './services/transactions.service'; @@ -53,6 +54,7 @@ import { TransactionFinderComponent } from './components/transaction-finder/tran providers: [ ErrorService, LanguageService, + NavigatorService, NotificationService, TransactionsService ], diff --git a/web-ui/src/app/services/navigator.service.ts b/web-ui/src/app/services/navigator.service.ts new file mode 100644 index 0000000..1c1544a --- /dev/null +++ b/web-ui/src/app/services/navigator.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; + +import { Router } from '@angular/router'; + +@Injectable() +export class NavigatorService { + + constructor(private router: Router) { } + + go(path: string) { + this.router.navigate([path]); + } + + transactionDetails(txid: string) { + this.go('/transactions/' + txid); + } +}