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

179
Visualizações
RxJs implementing refresh action from Observable chain

trying to implement refresh or poll with rxjs chain.

ngOnInit() {
    const id$ = this.route.params;

    id$.subscribe((params: Params) =>  {
        this.id = params['id'];
        this.userService.getUser(params['id']).subscribe(this.getUserSubject$));
    }

    this.getUserSubject$
      .flatMap(user =>
        Observable.forkJoin(this.userService.getAddress(user), this.userService.isActive(user),
          (address, isActive) => {
            return _.assign({}, user, address, {isActive: isActive});
          }
        )
      )
      .subscribe(user => {
        this.user = user
      }, err => this.error(err));
}

refresh($event) {
    this.userService.getUser(this.id).subscribe(this.getUserSubject$);
}

On refresh call the getUserSubject$ chain is not called. its called just once on ngOnInit. how to push data into the getUserSubject$, so that user is updated. why the observable chain in not called from refresh.

over 4 years ago · Santiago Trujillo
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