Answer the question
In order to leave comments, you need to log in
Does a resolver live without a subscription block?
There is such a resolver:
export class SuperResolver implements Resolve<any> {
constructor(private superService: SuperService, private store: Store<any>) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> {
return this.superService.getSuper().pipe(
tap(super) => {
this.store.dispatch(superAction({ super }));
})
);
}
}
Answer the question
In order to leave comments, you need to log in
There is generally a rather complicated process, but briefly - all resolvers are launched simultaneously, in the process of work they add their results to data, and the router waits through concatMap (and the subscription that you did not find inside it) when the whole bundle is completed to continue routing.
Those. any resolver must terminate. It will not work here to start the interval, the routing will simply hang.
It is better to place this in OnInit and stop when destroying.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question