barker/bookie/src/app/sections/section-list-resolver.service.ts
2019-06-23 19:29:33 +05:30

19 lines
587 B
TypeScript

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();
}
}