barker/bookie/src/app/sections/section-list-resolver.service.ts

19 lines
587 B
TypeScript
Raw Normal View History

2019-06-22 20:05:00 +00:00
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<Section[]> {
constructor(private ser: SectionService, private router: Router) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Section[]> {
return this.ser.list();
}
}