i have 2 angular resolvers works one after another. 1st
@Injectable()
export class ChainViewResolver implements Resolve<any> {
constructor(private a: AService) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> {
return this.a.getSome(route.params['id']);
}
}
and second,
@Injectable()
export class DocViewResolver implements Resolve<any> {
constructor(private a: AService) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> {
return this.a.getSome(state.url.split('/')[state.url.split('/').indexOf('id') + 1]).flatMap((chain) => {
return this.a.getSomeAnotherData(route.params['id2']).flatMap(result => {
});
});
}
}
url look like:
/parent_component/:id/children_component/:id
where 1st resolver for parent_component, and 2nd resolver for children_component
1) method getSome it's Heavy request, and i don't want use it 2 times, when my resolvers work together.
2) i dont want write it to some variable or to local storage, because getSome returned data often change, and when I use 1st resolver whithout second, I may have problems because of this
How can i pass my data from 1st resolver to 2nd?