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