Initial Commit
This commit is contained in:
19
otis/src/app/advocates/advocate-resolver.service.ts
Normal file
19
otis/src/app/advocates/advocate-resolver.service.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { Advocate } from '../core/advocate';
|
||||
|
||||
import { AdvocateService } from './advocate.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AdvocateResolver implements Resolve<Advocate> {
|
||||
constructor(private ser: AdvocateService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<Advocate> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user