30 lines
772 B
TypeScript
30 lines
772 B
TypeScript
/** Angular Imports */
|
|
import { Injectable } from '@angular/core';
|
|
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
|
|
/** rxjs Imports */
|
|
import { Observable } from 'rxjs';
|
|
|
|
/** Custom Services */
|
|
import { OrganizationService } from 'app/organization/organization.service';
|
|
|
|
/**
|
|
* Employee data resolver.
|
|
*/
|
|
@Injectable()
|
|
export class EmployeeResolver {
|
|
/**
|
|
* @param {OrganizationService} organizationService Organization service.
|
|
*/
|
|
constructor(private organizationService: OrganizationService) {}
|
|
|
|
/**
|
|
* Returns the employee data.
|
|
* @returns {Observable<any>}
|
|
*/
|
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
const employeeId = route.paramMap.get('id');
|
|
return this.organizationService.getEmployee(employeeId);
|
|
}
|
|
}
|