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

152
Visualizações
Use condition with map
canBeTransferred$ = this.userService
.getCurrentUser()
.pipe(map((user) => user.data.id === this.ticket.userId || user.data.isCsm || user.data.owner));

I have a observable like above and I want to add another condition

this.ticket.status !== 'Archived'

I am trying like

canBeTransferred$ = this.userService
.getCurrentUser()
.pipe(map((user) => user.data.id === this.ticket.userId || user.data.isCsm || user.data.owner) && this.ticket.status !== 'Archived');

but the compiler is throwing error. How to add it?

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

0

Seems that you put on the wrong place the new condition, it should be like:

canBeTransferred$ = this.userService
.getCurrentUser()
.pipe(map((user) => user.data.id === (this.ticket.userId || user.data.isCsm || 
user.data.owner) && this.ticket.status !== 'Archived'));

Just enclose in parentesis all the existing conditions and add another one next to the closing parentesis.

user.data.id === (this.ticket.userId || user.data.isCsm || 
user.data.owner) && this.ticket.status !== 'Archived'
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