1
2 content_copy
3
4 @Injectable({ providedIn: 'root' })
5export class HeroResolver implements Resolve<Hero> {
6 constructor(private service: HeroService) {}
7
8 resolve(
9 route: ActivatedRouteSnapshot,
10 state: RouterStateSnapshot
11 ): Observable<any>|Promise<any>|any {
12 return this.service.getHero(route.paramMap.get('id'));
13 }
14}
15