19 lines
442 B
TypeScript
19 lines
442 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Resolve } from '@angular/router';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Product } from '../core/product';
|
|
|
|
import { ProductService } from './product.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class ProductListResolver implements Resolve<Product[]> {
|
|
constructor(private ser: ProductService) {}
|
|
|
|
resolve(): Observable<Product[]> {
|
|
return this.ser.list();
|
|
}
|
|
}
|