import {Injectable} from '@angular/core'; import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router'; import {Section} from '../core/section'; import {Observable} from 'rxjs/internal/Observable'; import {SectionService} from './section.service'; @Injectable({ providedIn: 'root' }) export class SectionListResolver implements Resolve { constructor(private ser: SectionService, private router: Router) { } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { return this.ser.list(); } }