19 lines
587 B
TypeScript
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();
|
|
}
|
|
}
|