im having a problem with ngrx and my resolver in angular. I know the problem but i don't find a solution for it. I am selecting an account from my ngrx store and end the obs with the take(1), but because of the take(1) it always takes the first value so when i emit a new value the resolver doesnt get it. Can someone help me?
resolve(route: ActivatedRouteSnapshot): Observable<Account> {
const id = this.getParameter(route, 'accountId');
if (id) {
this._store.dispatch(AccountsPageActions.loadAccountWithDetails({ accountId: id }));
return this._store.select(getAccountDetailById(id)).pipe(
switchMap(account => this._store.select(getAccountError).pipe(
map(error => {
if (error instanceof HttpErrorResponse && error.message.includes(id)) {
this._utilService.showErrorToast('Zugang nicht gefunden');
this._router.navigateByUrl('/');
}
console.log(account);
return account
})
)),
skipWhile(account => account?.id !== id),
take(1)
);
}
return null;
}
Edit: The problem is i trigger the resolver in the same route. Example: I am opening an accordion item --> redirect to /account/{accountId1} and if i then open another accordion item i need to redirect to /account/{accountId2} but the resolver doesnt resolve because it doesnt get a new value with the new account.
The resolver was not my problem..
Had a problem with the angular material mat-tab-accordion