20 lines
669 B
TypeScript
20 lines
669 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
|
import { SectionPrinter } from '../core/section-printer';
|
|
import { Observable } from 'rxjs';
|
|
import { SectionPrinterService } from './section-printer.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class SectionPrinterResolver implements Resolve<SectionPrinter> {
|
|
|
|
constructor(private ser: SectionPrinterService, private router: Router) {
|
|
}
|
|
|
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<SectionPrinter> {
|
|
const id = route.paramMap.get('id');
|
|
return this.ser.get(id);
|
|
}
|
|
}
|