/** Angular Imports */ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot } from '@angular/router'; /** rxjs Imports */ import { Observable } from 'rxjs'; /** Custom Services */ import { LoansService } from '../loans.service'; /** * Clients data resolver. */ @Injectable() export class LoanTermVariationsResolver { /** * @param {LoansService} LoansService Loans service. */ constructor(private loansService: LoansService) {} /** * Returns the Loans with Association data. * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId'); if (!isNaN(+loanId)) { return this.loansService.getInterestPausesOfLoan(loanId); } } }