You did not provide any code cause your case should work without the need of cancelAllNavigationRequests you just not handling the HTTP error properly. Here is a method I used in a guard it might help or give you ideas, its similar to the one in the ngex example:
This Guard will check if a Classified already exist and not partial, before making a call to the service.
@Injectable()
export class ClassifiedGuardService implements CanActivate, CanActivateChild {
constructor(private store: Store<fromRoot.State>, private classifiedService: ClassifiedService, private router: Router) {
}
vendorClassifiedAlreadyLoaded(id: string): Observable<boolean> {
return this.store.pipe(
select(fromContext.selectAllClassifieds),
map(entities => {
for (let i = 0; i < entities.length; i++) {
if (entities[i].id === id && !entities[i].partial) {
return true;
}
}
return false;
}),
take(1)
);
}
getVendorClassifiedFromServer(id: string) {
return this.classifiedService.getVendorsClassified({id: id}).pipe(
map(payload => new ClassifiedAction.GetVendorsClassifiedSuccess(payload)),
tap((action: ClassifiedAction.GetVendorsClassifiedSuccess) => this.store.dispatch(action)),
map(payload => !!payload),
catchError(err => {
this.store.dispatch(new ClassifiedAction.GetVendorsClassifiedFail(err));
this.router.navigate(['/errors/bad-request']);
return of(false);
})
);
}
getFullClassified(id: string): Observable<boolean> {
return this.vendorClassifiedAlreadyLoaded(id).pipe(
switchMap(inStore => {
if (inStore) {
return of(inStore);
}
return this.getVendorClassifiedFromServer(id);
})
);
}
canActivate(route: ActivatedRouteSnapshot): Observable<boolean> {
return this.getFullClassified(route.params['id']);
}
canActivateChild(route: ActivatedRouteSnapshot) {
return this.canActivate(route);
}
}