barker/bookie/src/app/roles/role-list-resolver.service.ts

19 lines
557 B
TypeScript
Raw Normal View History

import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router';
import {Role} from './role';
import {Observable} from 'rxjs/internal/Observable';
import {RoleService} from './role.service';
@Injectable({
providedIn: 'root'
})
export class RoleListResolver implements Resolve<Role[]> {
constructor(private ser: RoleService, private router: Router) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Role[]> {
return this.ser.list();
}
}