I am looking for a solution to ignore one-time guard by passing parameter/flag/etc. in router navigate.
Current configuration:
- standard routing with auth
canActivate: [CanActivateGuard] - resolver - checking the subpath application - for loading snapshot, when the user got URL with some path, can load application,
Problem:
- above mechanism working great (snapshot, generate lost ngrx store data etc.)
- but in guard I am checking if some value exists in store:
canActivate(): boolean {
let canActivate = false;
this.store$.pipe(select(selectSth), take(1)).subscribe(item => {
if (!!item) {
return canActivate = true;
}
this.router.navigate(['/main']);
return canActivate = false;
});
return canActivate;
}
}
- canActivate was checked before resolver - so I can't navigate to
/mainpath even the parameter exists in store
Question:
There is any solution to add parameter to this.router.navigate and one time avoid guard?