20 lines
492 B
TypeScript
20 lines
492 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Section } from '../core/section';
|
|
|
|
import { SectionService } from './section.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class SectionResolver {
|
|
constructor(private ser: SectionService) {}
|
|
|
|
resolve(route: ActivatedRouteSnapshot): Observable<Section> {
|
|
const id = route.paramMap.get('id');
|
|
return this.ser.get(id);
|
|
}
|
|
}
|