Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
Ngrx and Angular Resolver

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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The resolver was not my problem..

Had a problem with the angular material mat-tab-accordion

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda