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