20 lines
533 B
TypeScript
20 lines
533 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
|
import { Observable } from 'rxjs/internal/Observable';
|
|
|
|
import { Court } from '../core/court';
|
|
|
|
import { CourtService } from './court.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class CourtResolver implements Resolve<Court> {
|
|
constructor(private ser: CourtService) {}
|
|
|
|
resolve(route: ActivatedRouteSnapshot): Observable<Court> {
|
|
const id = route.paramMap.get('id');
|
|
return this.ser.get(id);
|
|
}
|
|
}
|