Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda