2020-10-01 15:21:22 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
2020-10-10 03:15:05 +00:00
|
|
|
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
2020-10-01 15:21:22 +00:00
|
|
|
import { Observable } from 'rxjs/internal/Observable';
|
2020-10-10 03:15:05 +00:00
|
|
|
|
|
|
|
import { Role } from './role';
|
2020-10-01 15:21:22 +00:00
|
|
|
import { RoleService } from './role.service';
|
2018-05-25 13:49:00 +00:00
|
|
|
|
|
|
|
@Injectable({
|
2020-10-01 15:21:22 +00:00
|
|
|
providedIn: 'root',
|
2018-05-25 13:49:00 +00:00
|
|
|
})
|
2020-05-11 20:01:21 +00:00
|
|
|
export class RoleResolver implements Resolve<Role> {
|
2020-10-10 03:15:05 +00:00
|
|
|
constructor(private ser: RoleService) {}
|
2018-05-25 13:49:00 +00:00
|
|
|
|
2020-10-10 03:15:05 +00:00
|
|
|
resolve(route: ActivatedRouteSnapshot): Observable<Role> {
|
2018-05-25 13:49:00 +00:00
|
|
|
const id = route.paramMap.get('id');
|
|
|
|
return this.ser.get(id);
|
|
|
|
}
|
|
|
|
}
|