31 lines
869 B
TypeScript
31 lines
869 B
TypeScript
/** Angular Imports */
|
|
import { Injectable } from '@angular/core';
|
|
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
|
|
|
/** rxjs Imports */
|
|
import { Observable } from 'rxjs';
|
|
|
|
/** Custom Services */
|
|
import { SavingsService } from '../savings.service';
|
|
|
|
/**
|
|
* Savings Account data resolver.
|
|
*/
|
|
@Injectable()
|
|
export class SavingsAccountViewResolver implements Resolve<Object> {
|
|
/**
|
|
* @param {SavingsService} SavingsService Savings service.
|
|
*/
|
|
constructor(private savingsService: SavingsService) {}
|
|
|
|
/**
|
|
* Returns the Savings Account data.
|
|
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
|
* @returns {Observable<any>}
|
|
*/
|
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
const savingAccountId = route.paramMap.get('savingAccountId');
|
|
return this.savingsService.getSavingsAccountData(savingAccountId);
|
|
}
|
|
}
|