Feature: Moved temporal products into their own module and reverted the products module
20 lines
579 B
TypeScript
20 lines
579 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Product } from '../core/product';
|
|
|
|
import { TemporalProductService } from './temporal-product.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class TemporalProductResolverService implements Resolve<Product> {
|
|
constructor(private ser: TemporalProductService) {}
|
|
|
|
resolve(route: ActivatedRouteSnapshot): Observable<Product> {
|
|
const id = route.paramMap.get('id');
|
|
return this.ser.get(id as string);
|
|
}
|
|
}
|